

set more off

local models 300 301

foreach i of local models {

import delimited "mcss_prep/models/m`i'/phisum`i'.csv", varnames(1) encoding(ISO-8859-1) clear

rename lrmum`i' lrmum3 

expand 5
sort country party year
by country party year, sort: replace year=year[_n-1]+1 if year[_n-1]!=.
drop if year==year[_n+1]
drop if year==year[_n+2]
drop if year==year[_n+3]
drop if year==year[_n+4]
				****CHANGE BELOW*********
drop if year==year[_n+5]&countryname=="Czech Republic"
drop if year==year[_n+6]&countryname=="Czech Republic"

keep if countryname=="Albania"|countryname=="Bulgaria"|countryname=="Croatia"| ///
countryname=="Czech Republic"|countryname=="Estonia"|countryname=="Hungary"| ///
countryname=="Latvia"|countryname=="Lithuania"|countryname=="Macedonia"| countryname=="Poland"| ///
countryname=="Romania"|countryname=="Slovakia"|countryname=="Slovenia"

drop if year>2004

gen party_perc=0
gen party_perc2=0
gen party_perc3=0
gen party_perc4=0
gen party_perc5=0
gen party_perc6=0
gen party_perc7=0
gen party_perc8=0
gen party_perc9=0
gen party_perc10=0
gen party_perc11=0
gen party_perc12=0
gen party_perc13=0

gen number_parties=.
****BULGARIA
	*1990 government invested in december, will only use 1991; the parties are BSP(52.7) SDS(36) BZNS(4)
	*1991 change of government on nov 8 SDS (45.9) following elections
	replace party_perc=(52.7*(date("08111991", "DMY")-date("31121990", "DMY")))/(92.7*365)*lrmum3[_n-1] if ///
	countryname=="Bulgaria"& year==1991&party==80220
	
		replace party_perc2=(36*(date("08111991", "DMY")-date("31121990", "DMY")))/(92.7*365)*lrmum3[_n-1] if ///
	countryname=="Bulgaria"& year==1991&party==80410
	
		replace party_perc3=(4*(date("08111991", "DMY")-date("31121990", "DMY")))/(92.7*365)*lrmum3[_n-1] if ///
	countryname=="Bulgaria"& year==1991&party[_n-1]==80810
	
	*after the elections
	replace party_perc4=(45.9*(date("31121991", "DMY")-date("08111991", "DMY")))/(45.9*365)*lrmum3 if ///
	countryname=="Bulgaria"& year==1991&party==80410
	
				replace number_parties=(date("08111991", "DMY")-date ("31121990", "DMY"))/365*3+ ///
				(date("31121991", "DMY")-date ("08111991", "DMY"))/365*1 if countryname=="Bulgaria"& year==1991
	
	*1992  on 30/12 theres a caretaker technocratic government until then its still sds
		replace party_perc=(45.9*(date("30121992", "DMY")-date ("31121991", "DMY")))/(45.9*366)*lrmum3 if ///
	countryname=="Bulgaria"& year==1992&party==80410
	
	replace number_parties=1 if countryname=="Bulgaria"& year==1992
	
	*1993-1994 completely apolitical, will not use data from here
	
	
	*1995 change in gov on jan 25, BSP/cdl (52.1; 80228 in CMP) following elections in 1994; before it was techno
		replace party_perc=(52.1*(date("31121995", "DMY")-date ("25011995", "DMY")))/(52.1*365)*lrmum3 if ///
	countryname=="Bulgaria"& year==1995&party==80228
	
				replace number_parties=1 if countryname=="Bulgaria"& year==1995
				*fcoalition of 3 parties in fact

	*1996 full year BSP/CD"
		replace party_perc2=(52.1*(date("31121996", "DMY")-date ("31121995", "DMY")))/(52.1*365)*lrmum3 if ///
	countryname=="Bulgaria"& year==1996&party==80228
	
			replace number_parties=1 if countryname=="Bulgaria"& year==1996

	
	*1997 two changes; first gov change is SDS (28.8), but before elections on 12/02/1997
	*second gov is still SDS (57) on 21/05/1997 but after elections, but in manifesto is ODS, 80411
		replace party_perc=(52.1*(date("12021997", "DMY")-date ("31121996", "DMY")))/(52.1*365)*lrmum3[_n-1] if ///
	countryname=="Bulgaria"& year==1997&party[_n-1]==80228&party==80228
	
		replace party_perc2=(28.8*(date("21051997", "DMY")-date ("12021997", "DMY")))/(28.8*365)*lrmum3[_n-1] if ///
	countryname=="Bulgaria"& year==1997&party[_n-1]==80410&party==80410
														***ADDED THE ABOVE ONE ONLY FOR MCSS
	
		replace party_perc3=(57*(date("31121997", "DMY")-date ("21051997", "DMY")))/(57*365)*lrmum3 if ///
	countryname=="Bulgaria"& year==1997&party==80411
	
			replace number_parties=1 if countryname=="Bulgaria"& year==1997

	
	**1998 to 2000 just ods
		replace party_perc=lrmum3 if countryname=="Bulgaria"& year==1998&party==80411
		replace party_perc=lrmum3 if countryname=="Bulgaria"& year==1999&party==80411
		replace party_perc=lrmum3 if countryname=="Bulgaria"& year==2000&party==80411
		
			replace number_parties=1 if countryname=="Bulgaria"& year==1998
			replace number_parties=1 if countryname=="Bulgaria"& year==1999
			replace number_parties=1 if countryname=="Bulgaria"& year==2000

		
	*2001 change in gov on 24/07/2001 following elections; NDSV (50) DPS (8); BSP/KB (20)
		replace party_perc=(57*(date("24072001", "DMY")-date ("31122000", "DMY")))/(57*365)*lrmum3[_n-1] if ///
	countryname=="Bulgaria"& year==2001&party[_n-1]==80411
	
		replace party_perc2=(50*(date("31122001", "DMY")-date ("24072001", "DMY")))/(78.8*365)*lrmum3 if ///
	countryname=="Bulgaria"& year==2001&party==80902
	
		replace party_perc3=(8.8*(date("31122001", "DMY")-date ("24072001", "DMY")))/(78.8*365)*lrmum3 if ///
	countryname=="Bulgaria"& year==2001&party==80951
	
		replace party_perc4=(20*(date("31122001", "DMY")-date ("24072001", "DMY")))/(78.8*365)*lrmum3 if ///
	countryname=="Bulgaria"& year==2001&party==80221
	
	
				replace number_parties=(date("24072001", "DMY")-date ("31122000", "DMY"))/365*1+ ///
				(date("31122001", "DMY")-date ("24072001", "DMY"))/365*3 if countryname=="Bulgaria"& year==2001
				
	
	*2002 no change
		replace party_perc=(50*(date("31122002", "DMY")-date ("31122001", "DMY")))/(78.8*365)*lrmum3 if ///
	countryname=="Bulgaria"& year==2002&party==80902
	
		replace party_perc2=(8.8*(date("31122002", "DMY")-date ("31122001", "DMY")))/(78.8*365)*lrmum3 if ///
	countryname=="Bulgaria"& year==2002&party==80951
	
		replace party_perc3=(20*(date("31122002", "DMY")-date ("31122001", "DMY")))/(78.8*365)*lrmum3 if ///
	countryname=="Bulgaria"& year==2002&party==80221
	
					replace number_parties=3 if countryname=="Bulgaria"& year==2002

	
	*2003 no change
		replace party_perc=(50*(date("31122003", "DMY")-date ("31122002", "DMY")))/(78.8*365)*lrmum3 if ///
	countryname=="Bulgaria"& year==2003&party==80902
	
		replace party_perc2=(8.8*(date("31122003", "DMY")-date ("31122002", "DMY")))/(78.8*365)*lrmum3 if ///
	countryname=="Bulgaria"& year==2003&party==80951
	
		replace party_perc3=(20*(date("31122003", "DMY")-date ("31122002", "DMY")))/(78.8*365)*lrmum3 if ///
	countryname=="Bulgaria"& year==2003&party==80221
	
					replace number_parties=1 if countryname=="Bulgaria"& year==2003

	
	*2004 no change
		replace party_perc=(50*(date("31122004", "DMY")-date ("31122003", "DMY")))/(78.8*366)*lrmum3 if ///
	countryname=="Bulgaria"& year==2004&party==80902
	
		replace party_perc2=(8.8*(date("31122004", "DMY")-date ("31122003", "DMY")))/(78.8*366)*lrmum3 if ///
	countryname=="Bulgaria"& year==2004&party==80951
	
		replace party_perc3=(20*(date("31122004", "DMY")-date ("31122003", "DMY")))/(78.8*366)*lrmum3 if ///
	countryname=="Bulgaria"& year==2004&party==80221
	
					replace number_parties=1 if countryname=="Bulgaria"& year==2004

	
	
**CZECH R.
	
	*1993 same coalition ODS (38), kdu-csl(7.5), oda (7)
		replace party_perc=(38*(date("31121993", "DMY")-date ("31121992", "DMY")))/(52.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==1993&party==82413
	
		replace party_perc2=(7.5*(date("31121993", "DMY")-date ("31121992", "DMY")))/(52.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==1993&party==82523
	
		replace party_perc3=(7*(date("31121993", "DMY")-date ("31121992", "DMY")))/(52.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==1993&party==82412	
	
					replace number_parties=3 if countryname=="Czech Republic"& year==1993
					*kdu-csl is one party

	*1994 same coalition
		replace party_perc=(38*(date("31121994", "DMY")-date ("31121993", "DMY")))/(52.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==1994&party==82413
	
		replace party_perc2=(7.5*(date("31121994", "DMY")-date ("31121993", "DMY")))/(52.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==1994&party==82523
	
		replace party_perc3=(7*(date("31121994", "DMY")-date ("31121993", "DMY")))/(52.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==1994&party==82412
	
					replace number_parties=3 if countryname=="Czech Republic"& year==1994
		
	*1995 same coalition
		replace party_perc=(38*(date("31121995", "DMY")-date ("31121994", "DMY")))/(52.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==1995&party==82413
	
		replace party_perc2=(7.5*(date("31121995", "DMY")-date ("31121994", "DMY")))/(52.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==1995&party==82523
	
		replace party_perc3=(7*(date("31121995", "DMY")-date ("31121994", "DMY")))/(52.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==1995&party==82412
	
						replace number_parties=3 if countryname=="Czech Republic"& year==1995
	
	**1996 same coalition but following new elections and new gov on 25/07/1996
		replace party_perc=(38*(date("25071996", "DMY")-date ("31121995", "DMY")))/(52.5*366)*lrmum3[_n-1] if ///
	countryname=="Czech Republic"& year==1996&party[_n-1]==82413
	
		replace party_perc2=(7.5*(date("25071996", "DMY")-date ("31121995", "DMY")))/(52.5*366)*lrmum3[_n-1] if ///
	countryname=="Czech Republic"& year==1996&party[_n-1]==82523
	
		replace party_perc3=(7*(date("25071996", "DMY")-date ("31121995", "DMY")))/(52.5*366)*lrmum3[_n-1] if ///
	countryname=="Czech Republic"& year==1996&party[_n-1]==82412
	
						replace number_parties=3 if countryname=="Czech Republic"& year==1996

	
	*and new coalition
		replace party_perc4=(34*(date("31121996", "DMY")-date ("25071996", "DMY")))/(49.5*366)*lrmum3 if ///
	countryname=="Czech Republic"& year==1996&party==82413
	
		replace party_perc5=(9*(date("31121996", "DMY")-date ("25071996", "DMY")))/(49.5*366)*lrmum3 if ///
	countryname=="Czech Republic"& year==1996&party==82523
	
		replace party_perc6=(6.5*(date("31121996", "DMY")-date ("25071996", "DMY")))/(49.5*366)*lrmum3 if ///
	countryname=="Czech Republic"& year==1996&party==82412
	
	**1997 no change from 1996
		replace party_perc=(34*(date("31121997", "DMY")-date ("31121996", "DMY")))/(49.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==1997&party==82413
	
		replace party_perc2=(9*(date("31121997", "DMY")-date ("31121996", "DMY")))/(49.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==1997&party==82523
	
		replace party_perc3=(6.5*(date("31121997", "DMY")-date ("31121996", "DMY")))/(49.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==1997&party==82412
	
							replace number_parties=3 if countryname=="Czech Republic"& year==1997

	
	***1998 gov change on 19/08/1998 following election; just CSSD (37)
		replace party_perc=(34*(date("19081998", "DMY")-date ("31121997", "DMY")))/(49.5*365)*lrmum3[_n-1] if ///
	countryname=="Czech Republic"& year==1998&party[_n-1]==82413
	
		replace party_perc2=(9*(date("19081998", "DMY")-date ("31121997", "DMY")))/(49.5*365)*lrmum3[_n-1] if ///
	countryname=="Czech Republic"& year==1998&party[_n-1]==82523
	
		replace party_perc3=(6.5*(date("19081998", "DMY")-date ("31121997", "DMY")))/(49.5*365)*lrmum3[_n-1] if ///
	countryname=="Czech Republic"& year==1998&party[_n-1]==82412
	
	
	*and the new party
		replace party_perc4=(37*(date("31121998", "DMY")-date ("19081998", "DMY")))/(37*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==1998&party==82320
	
					replace number_parties=(date("19081998", "DMY")-date ("31121997", "DMY"))/365*3+ ///
				(date("31121998", "DMY")-date ("19081998", "DMY"))/365*1 if countryname=="Czech Republic"& year==1998
	
	***1999, 2000, 2001 just previous coalition
	replace party_perc=lrmum3 if countryname=="Czech Republic"& year==1999&party==82320
	replace party_perc=lrmum3 if countryname=="Czech Republic"& year==2000&party==82320
	replace party_perc=lrmum3 if countryname=="Czech Republic"& year==2001&party==82320
	
					replace number_parties=1 if countryname=="Czech Republic"& year==1999
					replace number_parties=1 if countryname=="Czech Republic"& year==2000
					replace number_parties=1 if countryname=="Czech Republic"& year==2001



	**2002 change in gov on 15/07/2002 following elections
		replace party_perc=(37*(date("15072002", "DMY")-date ("31122001", "DMY")))/(37*365)*lrmum3[_n-1] if ///
	countryname=="Czech Republic"& year==2002&party[_n-1]==82320
	*new coalition is cssd (35); kdu-csl (11); us-deu(4.5), which is in coalition with kdu-csl (82524)
		replace party_perc2=(35*(date("31122002", "DMY")-date ("15072002", "DMY")))/(50.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==2002&party==82320
	
		replace party_perc3=(11*(date("31122002", "DMY")-date ("15072002", "DMY")))/(50.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==2002&party==82524
	
		replace party_perc4=(4.5*(date("31122002", "DMY")-date ("15072002", "DMY")))/(50.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==2002&party==82524
	
					replace number_parties=(date("15072002", "DMY")-date ("31122001", "DMY"))/365*1+ ///
				(date("31122002", "DMY")-date ("15072002", "DMY"))/365*3 if countryname=="Czech Republic"& year==2002
				*still just 3 parties
	
	*2003 nothing changes
		replace party_perc=(35*(date("31122003", "DMY")-date ("31122002", "DMY")))/(50.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==2003&party==82320
	
		replace party_perc2=(11*(date("31122003", "DMY")-date ("31122002", "DMY")))/(50.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==2003&party==82524
	
		replace party_perc3=(4.5*(date("31122003", "DMY")-date ("31122002", "DMY")))/(50.5*365)*lrmum3 if ///
	countryname=="Czech Republic"& year==2003&party==82524
	
						replace number_parties=3 if countryname=="Czech Republic"& year==2003

	
		*2004 nothing changes
		replace party_perc=(35*(date("31122004", "DMY")-date ("31122003", "DMY")))/(50.5*366)*lrmum3 if ///
	countryname=="Czech Republic"& year==2004&party==82320
	
		replace party_perc2=(11*(date("31122004", "DMY")-date ("31122003", "DMY")))/(50.5*366)*lrmum3 if ///
	countryname=="Czech Republic"& year==2004&party==82524
	
		replace party_perc3=(4.5*(date("31122004", "DMY")-date ("31122003", "DMY")))/(50.5*366)*lrmum3 if ///
	countryname=="Czech Republic"& year==2004&party==82524
	
						replace number_parties=3 if countryname=="Czech Republic"& year==2004

	
	
	*****ESTONIA
	*first elections in 1992, so we start with 1993
	
	*1993 government formed in 1992 with IL(28.7); M (11.9); ERSP(9.9)
		replace party_perc=(28.7*(date("31121993", "DMY")-date ("31121992", "DMY")))/(50.5*365)*lrmum3 if ///
	countryname=="Estonia"& year==1993&party==83710	
		replace party_perc2=(11.9*(date("31121993", "DMY")-date ("31121992", "DMY")))/(50.5*365)*lrmum3 if ///
	countryname=="Estonia"& year==1993&party==83410	
		replace party_perc3=(9.9*(date("31121993", "DMY")-date ("31121992", "DMY")))/(50.5*365)*lrmum3 if ///
	countryname=="Estonia"& year==1993&party==83711
	
							replace number_parties=3 if countryname=="Estonia"& year==1993

	*1994 nothing changes
		replace party_perc=(28.7*(date("31121994", "DMY")-date ("31121993", "DMY")))/(50.5*365)*lrmum3 if ///
	countryname=="Estonia"& year==1994&party==83710	
		replace party_perc2=(11.9*(date("31121994", "DMY")-date ("31121993", "DMY")))/(50.5*365)*lrmum3 if ///
	countryname=="Estonia"& year==1994&party==83410	
		replace party_perc3=(9.9*(date("31121994", "DMY")-date ("31121993", "DMY")))/(50.5*365)*lrmum3 if ///
	countryname=="Estonia"& year==1994&party==83711
	
								replace number_parties=3 if countryname=="Estonia"& year==1994

	
	*1995 Change in gov following elections on 17/04/1995 KMU(40.6); Ek(15.8)
	*1995 change in gov without elections on 03/11/1995 Kmu and RE
		replace party_perc=(28.7*(date("17041995", "DMY")-date ("31121994", "DMY")))/(50.5*365)*lrmum3[_n-1] if ///
	countryname=="Estonia"& year==1995&party[_n-1]==83710	
		replace party_perc2=(11.9*(date("17041995", "DMY")-date ("31121994", "DMY")))/(50.5*365)*lrmum3[_n-1] if ///
	countryname=="Estonia"& year==1995&party[_n-1]==83410	
		replace party_perc3=(9.9*(date("17041995", "DMY")-date ("31121994", "DMY")))/(50.5*365)*lrmum3[_n-1] if ///
	countryname=="Estonia"& year==1995&party[_n-1]==83711	
	
	**second coalition
		replace party_perc4=(40.6*(date("03111995", "DMY")-date ("17041995", "DMY")))/(56.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==1995&party==83719
		replace party_perc5=(15.8*(date("03111995", "DMY")-date ("17041995", "DMY")))/(56.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==1995&party==83411
	
	***third coalition
		replace party_perc6=(40.6*(date("31121995", "DMY")-date ("03111995", "DMY")))/(59.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==1995&party==83719
		replace party_perc7=(18.8*(date("31121995", "DMY")-date ("03111995", "DMY")))/(59.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==1995&party==83430	
	
					replace number_parties=(date("17041995", "DMY")-date ("31121994", "DMY"))/365*3+ ///
					(date("31121995", "DMY")-date ("17041995", "DMY"))/365*2 if countryname=="Estonia"& year==1995
	
	
	*1996 same last coalition
		replace party_perc=(40.6*(date("31121996", "DMY")-date ("31121995", "DMY")))/(59.4*366)*lrmum3 if ///
	countryname=="Estonia"& year==1996&party==83719
		replace party_perc2=(18.8*(date("31121996", "DMY")-date ("31121995", "DMY")))/(59.4*366)*lrmum3 if ///
	countryname=="Estonia"& year==1996&party==83430	
	
									replace number_parties=2 if countryname=="Estonia"& year==1996

	
	
	*1997 change without elections, only KMU stays in government on 17/03/1997
		replace party_perc=(40.6*(date("17031997", "DMY")-date ("31121996", "DMY")))/(59.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==1997&party==83719
		replace party_perc2=(18.8*(date("17031997", "DMY")-date ("31121996", "DMY")))/(59.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==1997&party==83430	
		*and the new gov
		replace party_perc3=(40.6*(date("31121997", "DMY")-date ("17031997", "DMY")))/(40.6*365)*lrmum3 if ///
	countryname=="Estonia"& year==1997&party==83719	
	
					replace number_parties=(date("17031997", "DMY")-date ("31121996", "DMY"))/365*2+ ///
					(date("31121997", "DMY")-date ("17031997", "DMY"))/365*1 if countryname=="Estonia"& year==1997
	
	
	
	*1998 no change
		replace party_perc=lrmum3 if countryname=="Estonia"& year==1998&party==83719	
				
				replace number_parties=1 if countryname=="Estonia"& year==1998

		
	*1999 change in gov on 25/03/1999 follwoing elec IL(17.8); RE (17.8); M(16.8)
		replace party_perc=(40.6*(date("25031999", "DMY")-date ("31121998", "DMY")))/(40.6*365)*lrmum3[_n-1] if ///
	countryname=="Estonia"& year==1999&party[_n-1]==83719&party==83719	
	*second coalition
		replace party_perc2=(17.8*(date("31121999", "DMY")-date ("25031999", "DMY")))/(52.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==1999&party==83710
	
		replace party_perc3=(17.8*(date("31121999", "DMY")-date ("25031999", "DMY")))/(52.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==1999&party==83430
	
		replace party_perc4=(16.8*(date("31121999", "DMY")-date ("25031999", "DMY")))/(52.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==1999&party==83410
	
					replace number_parties=(date("25031999", "DMY")-date ("31121998", "DMY"))/365*1+ ///
					(date("31121999", "DMY")-date ("25031999", "DMY"))/365*3 if countryname=="Estonia"& year==1999
					
	*2000 no change
		replace party_perc=(17.8*(date("31122000", "DMY")-date ("31121999", "DMY")))/(52.4*366)*lrmum3 if ///
	countryname=="Estonia"& year==2000&party==83710
	
		replace party_perc2=(17.8*(date("31122000", "DMY")-date ("31121999", "DMY")))/(52.4*366)*lrmum3 if ///
	countryname=="Estonia"& year==2000&party==83430
	
		replace party_perc3=(16.8*(date("31122000", "DMY")-date ("31121999", "DMY")))/(52.4*366)*lrmum3 if ///
	countryname=="Estonia"& year==2000&party==83410	
	
					replace number_parties=3 if countryname=="Estonia"& year==2000

	
	*2001 no change
		replace party_perc=(17.8*(date("31122001", "DMY")-date ("31122000", "DMY")))/(52.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==2001&party==83710
	
		replace party_perc2=(17.8*(date("31122001", "DMY")-date ("31122000", "DMY")))/(52.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==2001&party==83430
	
		replace party_perc3=(16.8*(date("31122001", "DMY")-date ("31122000", "DMY")))/(52.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==2001&party==83410	
	
					replace number_parties=3 if countryname=="Estonia"& year==2001

	
	*2002 change in gov without elections on 28/01/2002 EK(27.7) and RE(17.8)
		replace party_perc=(17.8*(date("28012002", "DMY")-date ("31122001", "DMY")))/(52.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==2002&party==83710
	
		replace party_perc2=(17.8*(date("28012002", "DMY")-date ("31122001", "DMY")))/(52.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==2002&party==83430
	
		replace party_perc3=(16.8*(date("28012002", "DMY")-date ("31122001", "DMY")))/(52.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==2002&party==83410		
	
	*and new coalition
		replace party_perc4=(27.7*(date("31122002", "DMY")-date ("28012002", "DMY")))/(45.5*365)*lrmum3 if ///
	countryname=="Estonia"& year==2002&party==83411
		replace party_perc5=(17.8*(date("31122002", "DMY")-date ("28012002", "DMY")))/(45.5*365)*lrmum3 if ///
	countryname=="Estonia"& year==2002&party==83430
	
						replace number_parties=(date("28012002", "DMY")-date ("31122001", "DMY"))/365*3+ ///
					(date("31122002", "DMY")-date ("28012002", "DMY"))/365*2 if countryname=="Estonia"& year==2002
	
	*2003 change following elections on 10/04/2003
		replace party_perc=(27.7*(date("10042003", "DMY")-date ("31122002", "DMY")))/(45.5*365)*lrmum3[_n-1] if ///
	countryname=="Estonia"& year==2003&party[_n-1]==83411
		replace party_perc2=(17.8*(date("10042003", "DMY")-date ("31122002", "DMY")))/(45.5*365)*lrmum3[_n-1] if ///
	countryname=="Estonia"& year==2003&party[_n-1]==83430
	
	*second coalition RP(27.7); RE(18.8); RL(12.9)
		replace party_perc3=(27.7*(date("31122003", "DMY")-date ("10042003", "DMY")))/(59.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==2003&party==83611
		replace party_perc4=(18.8*(date("31122003", "DMY")-date ("10042003", "DMY")))/(59.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==2003&party==83430
		replace party_perc5=(12.9*(date("31122003", "DMY")-date ("10042003", "DMY")))/(59.4*365)*lrmum3 if ///
	countryname=="Estonia"& year==2003&party==83612
	
						replace number_parties=(date("10042003", "DMY")-date ("31122002", "DMY"))/365*2+ ///
					(date("31122003", "DMY")-date ("10042003", "DMY"))/365*3 if countryname=="Estonia"& year==2003
	
	*2004 no changes from previous coalition
		replace party_perc=(27.7*(date("31122004", "DMY")-date ("31122003", "DMY")))/(59.4*366)*lrmum3 if ///
	countryname=="Estonia"& year==2004&party==83611
		replace party_perc2=(18.8*(date("31122004", "DMY")-date ("31122003", "DMY")))/(59.4*366)*lrmum3 if ///
	countryname=="Estonia"& year==2004&party==83430
		replace party_perc3=(12.9*(date("31122004", "DMY")-date ("31122003", "DMY")))/(59.4*366)*lrmum3 if ///
	countryname=="Estonia"& year==2004&party==83612	
	
					replace number_parties=3 if countryname=="Estonia"& year==2004

	
	*****HUNGARY
	
	*1991 based on 1990 gov MDF (42.5), FKGP(11.4), KDNP(5.4)
	
		replace party_perc=(42.5*(date("31121991", "DMY")-date ("31121990", "DMY")))/(59.3*365)*lrmum3 if ///
	countryname=="Hungary"& year==1991&party==86521
		replace party_perc2=(11.4*(date("31121991", "DMY")-date ("31121990", "DMY")))/(59.3*365)*lrmum3 if ///
	countryname=="Hungary"& year==1991&party==86810
		replace party_perc3=(5.4*(date("31121991", "DMY")-date ("31121990", "DMY")))/(59.3*365)*lrmum3 if ///
	countryname=="Hungary"& year==1991&party==86522
	
					replace number_parties=3 if countryname=="Hungary"& year==1991
	
	** 1992, 1993 same coalition
		replace party_perc=(42.5*(date("31121992", "DMY")-date ("31121991", "DMY")))/(59.3*366)*lrmum3 if ///
	countryname=="Hungary"& year==1992&party==86521
		replace party_perc2=(11.4*(date("31121992", "DMY")-date ("31121991", "DMY")))/(59.3*366)*lrmum3 if ///
	countryname=="Hungary"& year==1992&party==86810
		replace party_perc3=(5.4*(date("31121992", "DMY")-date ("31121991", "DMY")))/(59.3*366)*lrmum3 if ///
	countryname=="Hungary"& year==1992&party==86522

					replace number_parties=3 if countryname=="Hungary"& year==1992

	
		replace party_perc=(42.5*(date("31121993", "DMY")-date ("31121992", "DMY")))/(59.3*365)*lrmum3 if ///
	countryname=="Hungary"& year==1993&party==86521
		replace party_perc2=(11.4*(date("31121993", "DMY")-date ("31121992", "DMY")))/(59.3*365)*lrmum3 if ///
	countryname=="Hungary"& year==1993&party==86810
		replace party_perc3=(5.4*(date("31121993", "DMY")-date ("31121992", "DMY")))/(59.3*365)*lrmum3 if ///
	countryname=="Hungary"& year==1993&party==86522
	
					replace number_parties=3 if countryname=="Hungary"& year==1993

	
	*1994 change in gov following elections on 15.07.1994:mszp(54.1) and szdsz(17.9)
	
		replace party_perc=(42.5*(date("15071994", "DMY")-date ("31121993", "DMY")))/(59.3*365)*lrmum3[_n-1] if ///
	countryname=="Hungary"& year==1994&party[_n-1]==86521
		replace party_perc2=(11.4*(date("15071994", "DMY")-date ("31121993", "DMY")))/(59.3*365)*lrmum3[_n-1] if ///
	countryname=="Hungary"& year==1994&party[_n-1]==86810
		replace party_perc3=(5.4*(date("15071994", "DMY")-date ("31121993", "DMY")))/(59.3*365)*lrmum3[_n-1] if ///
	countryname=="Hungary"& year==1994&party[_n-1]==86522
	
	*new coalition
		replace party_perc4=(54.1*(date("31121994", "DMY")-date ("15071994", "DMY")))/(72*365)*lrmum3 if ///
	countryname=="Hungary"& year==1994&party==86220
		replace party_perc5=(17.9*(date("31121994", "DMY")-date ("15071994", "DMY")))/(72*365)*lrmum3 if ///
	countryname=="Hungary"& year==1994&party==86422
	
						replace number_parties=(date("15071994", "DMY")-date ("31121993", "DMY"))/365*3+ ///
					(date("31121994", "DMY")-date ("15071994", "DMY"))/365*2 if countryname=="Hungary"& year==1994
					
	
	*1995, 1996, 1997 same coalition
		replace party_perc=(54.1*(date("31121995", "DMY")-date ("31121994", "DMY")))/(72*365)*lrmum3 if ///
	countryname=="Hungary"& year==1995&party==86220
		replace party_perc2=(17.9*(date("31121995", "DMY")-date ("31121994", "DMY")))/(72*365)*lrmum3 if ///
	countryname=="Hungary"& year==1995&party==86422
	
					replace number_parties=2 if countryname=="Hungary"& year==1995

		replace party_perc=(54.1*(date("31121996", "DMY")-date ("31121995", "DMY")))/(72*366)*lrmum3 if ///
	countryname=="Hungary"& year==1996&party==86220
		replace party_perc2=(17.9*(date("31121996", "DMY")-date ("31121995", "DMY")))/(72*366)*lrmum3 if ///
	countryname=="Hungary"& year==1996&party==86422

					replace number_parties=2 if countryname=="Hungary"& year==1996

	
		replace party_perc=(54.1*(date("31121997", "DMY")-date ("31121996", "DMY")))/(72*365)*lrmum3 if ///
	countryname=="Hungary"& year==1997&party==86220
		replace party_perc2=(17.9*(date("31121997", "DMY")-date ("31121996", "DMY")))/(72*365)*lrmum3 if ///
	countryname=="Hungary"& year==1997&party==86422
	
					replace number_parties=2 if countryname=="Hungary"& year==1997

	
	*1998 change in gov following elections on 06/07/1998: fidesz(38.3), fkgp(12.4), mdf(4.4)
		replace party_perc=(54.1*(date("06071998", "DMY")-date ("31121997", "DMY")))/(72*365)*lrmum3[_n-1] if ///
	countryname=="Hungary"& year==1998&party[_n-1]==86220
		replace party_perc2=(17.9*(date("06071998", "DMY")-date ("31121997", "DMY")))/(72*365)*lrmum3[_n-1] if ///
	countryname=="Hungary"& year==1998&party[_n-1]==86422	
	
	*new coalition
		replace party_perc3=(38.3*(date("31121998", "DMY")-date ("06071998", "DMY")))/(55.1*365)*lrmum3 if ///
	countryname=="Hungary"& year==1998&party==86421
		replace party_perc4=(12.4*(date("31121998", "DMY")-date ("06071998", "DMY")))/(55.1*365)*lrmum3 if ///
	countryname=="Hungary"& year==1998&party==86810
		replace party_perc5=(4.4*(date("31121998", "DMY")-date ("06071998", "DMY")))/(55.1*365)*lrmum3 if ///
	countryname=="Hungary"& year==1998&party==86521
	
					replace number_parties=(date("06071998", "DMY")-date ("31121997", "DMY"))/365*2+ ///
					(date("31121998", "DMY")-date ("06071998", "DMY"))/365*3 if countryname=="Hungary"& year==1998
	
	**1999-2001 nothing changes
		replace party_perc=(38.3*(date("31121999", "DMY")-date ("31121998", "DMY")))/(55.1*365)*lrmum3 if ///
	countryname=="Hungary"& year==1999&party==86421
		replace party_perc2=(12.4*(date("31121999", "DMY")-date ("31121998", "DMY")))/(55.1*365)*lrmum3 if ///
	countryname=="Hungary"& year==1999&party==86810
		replace party_perc3=(4.4*(date("31121999", "DMY")-date ("31121998", "DMY")))/(55.1*365)*lrmum3 if ///
	countryname=="Hungary"& year==1999&party==86521
	
					replace number_parties=3 if countryname=="Hungary"& year==1999

	
			replace party_perc=(38.3*(date("31122000", "DMY")-date ("31121999", "DMY")))/(55.1*366)*lrmum3 if ///
	countryname=="Hungary"& year==2000&party==86421
		replace party_perc2=(12.4*(date("31122000", "DMY")-date ("31121999", "DMY")))/(55.1*366)*lrmum3 if ///
	countryname=="Hungary"& year==2000&party==86810
		replace party_perc3=(4.4*(date("31122000", "DMY")-date ("31121999", "DMY")))/(55.1*366)*lrmum3 if ///
	countryname=="Hungary"& year==2000&party==86521

					replace number_parties=3 if countryname=="Hungary"& year==2000

	
			replace party_perc=(38.3*(date("31122001", "DMY")-date ("31122000", "DMY")))/(55.1*365)*lrmum3 if ///
	countryname=="Hungary"& year==2001&party==86421
		replace party_perc2=(12.4*(date("31122001", "DMY")-date ("31122000", "DMY")))/(55.1*365)*lrmum3 if ///
	countryname=="Hungary"& year==2001&party==86810
		replace party_perc3=(4.4*(date("31122001", "DMY")-date ("31122000", "DMY")))/(55.1*365)*lrmum3 if ///
	countryname=="Hungary"& year==2001&party==86521
	
					replace number_parties=3 if countryname=="Hungary"& year==2001

	
	***2002change in gov on 07/05/2002 following elections mszp(46.1); szdsz(5.2)
	
		replace party_perc=(38.3*(date("07052002", "DMY")-date ("31122001", "DMY")))/(55.1*365)*lrmum3[_n-1] if ///
	countryname=="Hungary"& year==2002&party[_n-1]==86421
		replace party_perc2=(12.4*(date("07052002", "DMY")-date ("31122001", "DMY")))/(55.1*365)*lrmum3[_n-1] if ///
	countryname=="Hungary"& year==2002&party[_n-1]==86810
		replace party_perc3=(4.4*(date("07052002", "DMY")-date ("31122001", "DMY")))/(55.1*365)*lrmum3[_n-1] if ///
	countryname=="Hungary"& year==2002&party[_n-1]==86521
	
	*and the new gov
		replace party_perc4=(46.1*(date("31122002", "DMY")-date ("07052002", "DMY")))/(51.3*365)*lrmum3 if ///
	countryname=="Hungary"& year==2002&party==86220
		replace party_perc5=(5.2*(date("31122002", "DMY")-date ("07052002", "DMY")))/(51.3*365)*lrmum3 if ///
	countryname=="Hungary"& year==2002&party==86422
	
					replace number_parties=(date("07052002", "DMY")-date ("31122001", "DMY"))/365*3+ ///
					(date("31122002", "DMY")-date ("07052002", "DMY"))/365*2 if countryname=="Hungary"& year==2002
	
	***2003-2004 just same gov
		replace party_perc=(46.1*(date("31122003", "DMY")-date ("31122002", "DMY")))/(51.3*365)*lrmum3 if ///
	countryname=="Hungary"& year==2003&party==86220
		replace party_perc=(5.2*(date("31122003", "DMY")-date ("31122002", "DMY")))/(51.3*365)*lrmum3 if ///
	countryname=="Hungary"& year==2003&party==86422

					replace number_parties=2 if countryname=="Hungary"& year==2003

	
		replace party_perc=(46.1*(date("31122004", "DMY")-date ("31122003", "DMY")))/(51.3*366)*lrmum3 if ///
	countryname=="Hungary"& year==2004&party==86220
		replace party_perc=(5.2*(date("31122004", "DMY")-date ("31122003", "DMY")))/(51.3*366)*lrmum3 if ///
	countryname=="Hungary"& year==2004&party==86422
	
					replace number_parties=2 if countryname=="Hungary"& year==2004

	
*******LATVIA
	*1994 following elections in 1993 LC (36) and LZS (12)
		* on 15/09/1994 its only lc with 36
	replace party_perc=(36*(date("15091994", "DMY")-date ("31121993", "DMY")))/(48*365)*lrmum3 if ///
	 countryname=="Latvia"&year==1994&party==87410
	 
	replace party_perc2=(12*(date("15091994", "DMY")-date ("31121993", "DMY")))/(48*365)*lrmum3 if ///
	 countryname=="Latvia"&year==1994&party==87810
	
	replace party_perc3=(36*(date("31121994", "DMY")-date ("15091994", "DMY")))/(36*365)*lrmum3 if ///
	 countryname=="Latvia"&year==1994&party==87410
	 
					replace number_parties=(date("15091994", "DMY")-date ("31121993", "DMY"))/365*2+ ///
					(date("31121994", "DMY")-date ("15091994", "DMY"))/365*1 if countryname=="Latvia"& year==1994
	
	*1995 new gov on 12/12/1995 following elections dps(18); lc(17); tb(14); lnnk(8); lvp(8); lzs/kds(8)
		replace party_perc=(36*(date("12121995", "DMY")-date ("31121994", "DMY")))/(36*365)*lrmum3[_n-1] if ///
	countryname=="Latvia"& year==1995&party[_n-1]==87410&party==87410
	
	*and new coalition
		replace party_perc2=(18*(date("31121995", "DMY")-date ("12121995", "DMY")))/(73*365)*lrmum3 if ///
	countryname=="Latvia"& year==1995&party==87411
		replace party_perc3=(17*(date("31121995", "DMY")-date ("12121995", "DMY")))/(73*365)*lrmum3 if ///
	countryname=="Latvia"& year==1995&party==87410
		replace party_perc4=(14*(date("31121995", "DMY")-date ("12121995", "DMY")))/(73*365)*lrmum3 if ///
	countryname=="Latvia"& year==1995&party==87721
		replace party_perc5=(8*(date("31121995", "DMY")-date ("12121995", "DMY")))/(73*365)*lrmum3 if ///
	countryname=="Latvia"& year==1995&party==87611
		replace party_perc6=(8*(date("31121995", "DMY")-date ("12121995", "DMY")))/(73*365)*lrmum3 if ///
	countryname=="Latvia"& year==1995&party==87320
		replace party_perc7=(8*(date("31121995", "DMY")-date ("12121995", "DMY")))/(73*365)*lrmum3 if ///
	countryname=="Latvia"& year==1995&party==87811
	
					replace number_parties=(date("12121995", "DMY")-date ("31121994", "DMY"))/365*1+ ///
					(date("31121995", "DMY")-date ("12121995", "DMY"))/365*7 if countryname=="Latvia"& year==1995
					**lzs-kds are two parties
	
	*1996 same coalition
		replace party_perc=(18*(date("31121996", "DMY")-date ("31121995", "DMY")))/(73*366)*lrmum3 if ///
	countryname=="Latvia"& year==1996&party==87411
		replace party_perc2=(17*(date("31121996", "DMY")-date ("31121995", "DMY")))/(73*366)*lrmum3 if ///
	countryname=="Latvia"& year==1996&party==87410
		replace party_perc3=(14*(date("31121996", "DMY")-date ("31121995", "DMY")))/(73*366)*lrmum3 if ///
	countryname=="Latvia"& year==1996&party==87721
		replace party_perc4=(8*(date("31121996", "DMY")-date ("31121995", "DMY")))/(73*366)*lrmum3 if ///
	countryname=="Latvia"& year==1996&party==87611
		replace party_perc5=(8*(date("31121996", "DMY")-date ("31121995", "DMY")))/(73*366)*lrmum3 if ///
	countryname=="Latvia"& year==1996&party==87320
		replace party_perc6=(8*(date("31121996", "DMY")-date ("31121995", "DMY")))/(73*366)*lrmum3 if ///
	countryname=="Latvia"& year==1996&party==87811
	
					replace number_parties=7 if countryname=="Latvia"& year==1996

	
	***1997 change in gov without elections on 13/02/1997; basically same coalition minus LVP
	*so I just reduce the number of days for LVP; but first the same coalition
		replace party_perc=(18*(date("13021997", "DMY")-date ("31121996", "DMY")))/(73*365)*lrmum3 if ///
	countryname=="Latvia"& year==1997&party==87411
		replace party_perc2=(17*(date("13021997", "DMY")-date ("31121996", "DMY")))/(73*365)*lrmum3 if ///
	countryname=="Latvia"& year==1997&party==87410
		replace party_perc3=(14*(date("13021997", "DMY")-date ("31121996", "DMY")))/(73*365)*lrmum3 if ///
	countryname=="Latvia"& year==1997&party==87721
		replace party_perc4=(8*(date("13021997", "DMY")-date ("31121996", "DMY")))/(73*365)*lrmum3 if ///
	countryname=="Latvia"& year==1997&party==87611
		replace party_perc5=(8*(date("13021997", "DMY")-date ("31121996", "DMY")))/(73*365)*lrmum3 if ///
	countryname=="Latvia"& year==1997&party==87320
		replace party_perc6=(8*(date("13021997", "DMY")-date ("31121996", "DMY")))/(73*365)*lrmum3 if ///
	countryname=="Latvia"& year==1997&party==87811
	
	*the changed coalition under party_perc2
		replace party_perc7=(18*(date("31121997", "DMY")-date ("13021997", "DMY")))/(65*365)*lrmum3 if ///
	countryname=="Latvia"& year==1997&party==87411
		replace party_perc8=(17*(date("31121997", "DMY")-date ("13021997", "DMY")))/(65*365)*lrmum3 if ///
	countryname=="Latvia"& year==1997&party==87410
		replace party_perc9=(14*(date("31121997", "DMY")-date ("13021997", "DMY")))/(65*365)*lrmum3 if ///
	countryname=="Latvia"& year==1997&party==87721
		replace party_perc10=(8*(date("31121997", "DMY")-date ("13021997", "DMY")))/(65*365)*lrmum3 if ///
	countryname=="Latvia"& year==1997&party==87611
	
		replace party_perc11=(8*(date("31121997", "DMY")-date ("13021997", "DMY")))/(65*365)*lrmum3 if ///
	countryname=="Latvia"& year==1997&party==87811
	
					replace number_parties=(date("13021997", "DMY")-date ("31121996", "DMY"))/365*7+ ///
					(date("31121997", "DMY")-date ("13021997", "DMY"))/365*6 if countryname=="Latvia"& year==1997
					
	**1998 change in gov on 06/04/1998 without elections; DPS falls
	**there is a second change after elections on 26/11/1998
	**first the coalition at the beginning
		replace party_perc=(18*(date("06041998", "DMY")-date ("31121997", "DMY")))/(65*365)*lrmum3[_n-1] if ///
	countryname=="Latvia"& year==1998&party[_n-1]==87411
		replace party_perc2=(17*(date("06041998", "DMY")-date ("31121997", "DMY")))/(65*365)*lrmum3[_n-1] if ///
	countryname=="Latvia"& year==1998&party[_n-1]==87410
		replace party_perc3=(14*(date("06041998", "DMY")-date ("31121997", "DMY")))/(65*365)*lrmum3[_n-1] if ///
	countryname=="Latvia"& year==1998&party[_n-1]==87721
		replace party_perc4=(8*(date("06041998", "DMY")-date ("31121997", "DMY")))/(65*365)*lrmum3[_n-1] if ///
	countryname=="Latvia"& year==1998&party[_n-1]==87611
	
		replace party_perc5=(8*(date("06041998", "DMY")-date ("31121997", "DMY")))/(65*365)*lrmum3[_n-1] if ///
	countryname=="Latvia"& year==1998&party[_n-1]==87811
	
	**and the second coalition bw 06/04/1998 and 26/11/1998
		replace party_perc6=(17*(date("26111998", "DMY")-date ("06041998", "DMY")))/(47*365)*lrmum3[_n-1] if ///
	countryname=="Latvia"& year==1998&party[_n-1]==87410
		replace party_perc7=(14*(date("26111998", "DMY")-date ("06041998", "DMY")))/(47*365)*lrmum3[_n-1] if ///
	countryname=="Latvia"& year==1998&party[_n-1]==87721
		replace party_perc8=(8*(date("26111998", "DMY")-date ("06041998", "DMY")))/(47*365)*lrmum3[_n-1] if ///
	countryname=="Latvia"& year==1998&party[_n-1]==87611
	
		replace party_perc9=(8*(date("26111998", "DMY")-date ("06041998", "DMY")))/(47*365)*lrmum3[_n-1] if ///
	countryname=="Latvia"& year==1998&party[_n-1]==87811
	
	****third coalition lc(21); tb/lnnk(17); jp(8)
		replace party_perc10=(21*(date("31121998", "DMY")-date ("26111998", "DMY")))/(46*365)*lrmum3 if ///
	countryname=="Latvia"& year==1998&party==87410
		replace party_perc11=(17*(date("31121998", "DMY")-date ("26111998", "DMY")))/(46*365)*lrmum3 if ///
	countryname=="Latvia"& year==1998&party==87723
		replace party_perc12=(8*(date("31121998", "DMY")-date ("26111998", "DMY")))/(46*365)*lrmum3 if ///
	countryname=="Latvia"& year==1998&party==87431
	
	
					replace number_parties=(date("06041998", "DMY")-date ("31121997", "DMY"))/365*6+ ///
					(date("26111998", "DMY")-date ("06041998", "DMY"))/365*5+ ///
					(date("31121998", "DMY")-date ("26111998", "DMY"))/365*3 if countryname=="Latvia"& year==1998
	
	***1999 two changes in gov without elections on 04/02/1999 and 16/07/1999
	*first the coalition at start of year
		replace party_perc=(21*(date("04021999", "DMY")-date ("31121998", "DMY")))/(46*365)*lrmum3 if ///
	countryname=="Latvia"& year==1999&party==87410
		replace party_perc2=(17*(date("04021999", "DMY")-date ("31121998", "DMY")))/(46*365)*lrmum3 if ///
	countryname=="Latvia"& year==1999&party==87723
		replace party_perc3=(8*(date("04021999", "DMY")-date ("31121998", "DMY")))/(46*365)*lrmum3 if ///
	countryname=="Latvia"& year==1999&party==87431
	
	*second coalition same three parties above+ lsda(14)
		replace party_perc4=(21*(date("16071999", "DMY")-date ("04021999", "DMY")))/(60*365)*lrmum3 if ///
	countryname=="Latvia"& year==1999&party==87410
		replace party_perc5=(17*(date("16071999", "DMY")-date ("04021999", "DMY")))/(60*365)*lrmum3 if ///
	countryname=="Latvia"& year==1999&party==87723
		replace party_perc6=(8*(date("16071999", "DMY")-date ("04021999", "DMY")))/(60*365)*lrmum3 if ///
	countryname=="Latvia"& year==1999&party==87431
	
		replace party_perc7=(14*(date("16071999", "DMY")-date ("04021999", "DMY")))/(60*365)*lrmum3 if ///
	countryname=="Latvia"& year==1999&party==87311
	
	**third coalition tp lc tb/lnnk
		replace party_perc8=(24*(date("31121999", "DMY")-date ("16071999", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Latvia"& year==1999&party==87610
	
		replace party_perc9=(21*(date("31121999", "DMY")-date ("16071999", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Latvia"& year==1999&party==87410
		replace party_perc10=(17*(date("31121999", "DMY")-date ("16071999", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Latvia"& year==1999&party==87723
	
					replace number_parties=(date("04021999", "DMY")-date ("31121998", "DMY"))/365*3+ ///
					(date("16071999", "DMY")-date ("04021999", "DMY"))/365*4+ ///
					(date("31121999", "DMY")-date ("16071999", "DMY"))/365*4 if countryname=="Latvia"& year==1999
					*tb-lnnk are two parties
	
	**2000 change without elections on 04/05/2000, same coalition plus jp
	*first the remnant from previous year
		replace party_perc=(24*(date("04052000", "DMY")-date ("31121999", "DMY")))/(62*366)*lrmum3 if ///
	countryname=="Latvia"& year==2000&party==87610
	
		replace party_perc2=(21*(date("04052000", "DMY")-date ("31121999", "DMY")))/(62*366)*lrmum3 if ///
	countryname=="Latvia"& year==2000&party==87410
		replace party_perc3=(17*(date("04052000", "DMY")-date ("31121999", "DMY")))/(62*366)*lrmum3 if ///
	countryname=="Latvia"& year==2000&party==87723
	
	*second coalition
		replace party_perc4=(24*(date("31122000", "DMY")-date ("04052000", "DMY")))/(70*366)*lrmum3 if ///
	countryname=="Latvia"& year==2000&party==87610
	
		replace party_perc5=(21*(date("31122000", "DMY")-date ("04052000", "DMY")))/(70*366)*lrmum3 if ///
	countryname=="Latvia"& year==2000&party==87410
		replace party_perc6=(17*(date("31122000", "DMY")-date ("04052000", "DMY")))/(70*366)*lrmum3 if ///
	countryname=="Latvia"& year==2000&party==87723
	
		replace party_perc7=(8*(date("31122000", "DMY")-date ("04052000", "DMY")))/(70*366)*lrmum3 if ///
	countryname=="Latvia"& year==2000&party==87431
	
					replace number_parties=(date("04052000", "DMY")-date ("31121999", "DMY"))/366*4+ ///
					(date("31122000", "DMY")-date ("04052000", "DMY"))/366*5  if countryname=="Latvia"& year==2000
	
	*2001 same coalition from the end of 2000
		replace party_perc=(24*(date("31122001", "DMY")-date ("31122000", "DMY")))/(70*365)*lrmum3 if ///
	countryname=="Latvia"& year==2001&party==87610
	
		replace party_perc2=(21*(date("31122001", "DMY")-date ("31122000", "DMY")))/(70*365)*lrmum3 if ///
	countryname=="Latvia"& year==2001&party==87410
		replace party_perc3=(17*(date("31122001", "DMY")-date ("31122000", "DMY")))/(70*365)*lrmum3 if ///
	countryname=="Latvia"& year==2001&party==87723
	
		replace party_perc4=(8*(date("31122001", "DMY")-date ("31122000", "DMY")))/(70*365)*lrmum3 if ///
	countryname=="Latvia"& year==2001&party==87431

					replace number_parties=5 if countryname=="Latvia"& year==2001
					*tb-lnnk are two parties

	
	**2002 change following elections on 05/11/2002: jl(26); zzs(12); tb/lnnk(7); lpp(10)
	*first the remnant
		replace party_perc=(24*(date("05112002", "DMY")-date ("31122001", "DMY")))/(70*365)*lrmum3[_n-1] if ///
	countryname=="Latvia"& year==2002&party[_n-1]==87610
	
		replace party_perc2=(21*(date("05112002", "DMY")-date ("31122001", "DMY")))/(70*365)*lrmum3[_n-1] if ///
	countryname=="Latvia"& year==2002&party[_n-1]==87410
		replace party_perc3=(17*(date("05112002", "DMY")-date ("31122001", "DMY")))/(70*365)*lrmum3[_n-1] if ///
	countryname=="Latvia"& year==2002&party[_n-1]==87723
	
		replace party_perc4=(8*(date("05112002", "DMY")-date ("31122001", "DMY")))/(70*365)*lrmum3[_n-1] if ///
	countryname=="Latvia"& year==2002&party[_n-1]==87431
	
	*and the second coalition
		replace party_perc5=(26*(date("31122002", "DMY")-date ("05112002", "DMY")))/(55*365)*lrmum3 if ///
	countryname=="Latvia"& year==2002&party==87423	
		replace party_perc6=(12*(date("31122002", "DMY")-date ("05112002", "DMY")))/(55*365)*lrmum3 if ///
	countryname=="Latvia"& year==2002&party==87110
		replace party_perc7=(7*(date("31122002", "DMY")-date ("05112002", "DMY")))/(55*365)*lrmum3 if ///
	countryname=="Latvia"& year==2002&party==87723
		replace party_perc8=(10*(date("31122002", "DMY")-date ("05112002", "DMY")))/(55*365)*lrmum3 if ///
	countryname=="Latvia"& year==2002&party==87521
	
					replace number_parties=5 if countryname=="Latvia"& year==2002
					*tb-lnnk are two parties
	
	*2003 the same coalition for the entire year
		replace party_perc=(26*(date("31122003", "DMY")-date ("31122002", "DMY")))/(55*365)*lrmum3 if ///
	countryname=="Latvia"& year==2003&party==87423	
		replace party_perc2=(12*(date("31122003", "DMY")-date ("31122002", "DMY")))/(55*365)*lrmum3 if ///
	countryname=="Latvia"& year==2003&party==87110
		replace party_perc3=(7*(date("31122003", "DMY")-date ("31122002", "DMY")))/(55*365)*lrmum3 if ///
	countryname=="Latvia"& year==2003&party==87723
		replace party_perc4=(10*(date("31122003", "DMY")-date ("31122002", "DMY")))/(55*365)*lrmum3 if ///
	countryname=="Latvia"& year==2003&party==87521
	
					replace number_parties=5 if countryname=="Latvia"& year==2003
					*tb-lnnk are two parties
	
	*2004 two changes without elections on 09/03/2004 and 02/12/2004
	*first the remnant
		replace party_perc=(26*(date("09032004", "DMY")-date ("31122003", "DMY")))/(55*366)*lrmum3 if ///
	countryname=="Latvia"& year==2004&party==87423	
		replace party_perc2=(12*(date("09032004", "DMY")-date ("31122003", "DMY")))/(55*366)*lrmum3 if ///
	countryname=="Latvia"& year==2004&party==87110
		replace party_perc3=(7*(date("09032004", "DMY")-date ("31122003", "DMY")))/(55*366)*lrmum3 if ///
	countryname=="Latvia"& year==2004&party==87723
		replace party_perc4=(10*(date("09032004", "DMY")-date ("31122003", "DMY")))/(55*366)*lrmum3 if ///
	countryname=="Latvia"& year==2004&party==87521
	
	*second coalition tp, zzs, lpp
		replace party_perc5=(20*(date("02122004", "DMY")-date ("09032004", "DMY")))/(42*366)*lrmum3 if ///
	countryname=="Latvia"& year==2004&party==87610
		replace party_perc6=(12*(date("02122004", "DMY")-date ("09032004", "DMY")))/(42*366)*lrmum3 if ///
	countryname=="Latvia"& year==2004&party==87110
		replace party_perc7=(10*(date("02122004", "DMY")-date ("09032004", "DMY")))/(42*366)*lrmum3 if ///
	countryname=="Latvia"& year==2004&party==87521
	
	*third coalition jl tp zzs lpp
		replace party_perc8=(26*(date("31122004", "DMY")-date ("02122004", "DMY")))/(68*366)*lrmum3 if ///
	countryname=="Latvia"& year==2004&party==87423

		replace party_perc9=(20*(date("31122004", "DMY")-date ("02122004", "DMY")))/(68*366)*lrmum3 if ///
	countryname=="Latvia"& year==2004&party==87610
		replace party_perc10=(12*(date("31122004", "DMY")-date ("02122004", "DMY")))/(68*366)*lrmum3 if ///
	countryname=="Latvia"& year==2004&party==87110
		replace party_perc11=(10*(date("31122004", "DMY")-date ("02122004", "DMY")))/(68*366)*lrmum3 if ///
	countryname=="Latvia"& year==2004&party==87521
	
					replace number_parties=(date("09032004", "DMY")-date ("31122003", "DMY"))/366*5+ ///
					(date("02122004", "DMY")-date ("09032004", "DMY"))/366*3+ ///
					(date("31122004", "DMY")-date ("02122004", "DMY"))/366*4 if countryname=="Latvia"& year==2004
	
	
	
	*******LITHUANIA
	****on 02/12/1992 we have the first gov withonly one party LDDP
	*1993-1995 same gov 
		replace party_perc=lrmum3 if countryname=="Lithuania"&year==1993&party==88220
		replace party_perc=lrmum3 if countryname=="Lithuania"&year==1994&party==88220
		replace party_perc=lrmum3 if countryname=="Lithuania"&year==1995&party==88220
	
					replace number_parties=1 if countryname=="Lithuania"& year==1993
					replace number_parties=1 if countryname=="Lithuania"& year==1994
					replace number_parties=1 if countryname=="Lithuania"& year==1995

		
	*1996 change in gov on 27/11/1996 following elections
	*first the existing gov
		replace party_perc=(51.8*(date("27111996", "DMY")-date ("31121995", "DMY")))/(51.8*366)*lrmum3[_n-1] if ///
	countryname=="Lithuania"&year==1996&party[_n-1]==88220
	*second coalition ts-lk; lkdp; lcs;
		replace party_perc2=(51.1*(date("31121996", "DMY")-date ("27111996", "DMY")))/(72.3*366)*lrmum3 if ///
	countryname=="Lithuania"&year==1996&party==88620
		replace party_perc3=(11.7*(date("31121996", "DMY")-date ("27111996", "DMY")))/(72.3*366)*lrmum3 if ///
	countryname=="Lithuania"&year==1996&party==88521
		replace party_perc4=(9.5*(date("31121996", "DMY")-date ("27111996", "DMY")))/(72.3*366)*lrmum3 if ///
	countryname=="Lithuania"&year==1996&party==88420
	
					replace number_parties=(date("27111996", "DMY")-date ("31121995", "DMY"))/366*1+ ///
					(date("31121996", "DMY")-date ("27111996", "DMY"))/366*3  if countryname=="Lithuania"& year==1996
					*ts-lk is only one party
					
	**1997, 1998, 1999 same gov
		replace party_perc=(51.1*(date("31121997", "DMY")-date ("31121996", "DMY")))/(72.3*365)*lrmum3 if ///
	countryname=="Lithuania"&year==1997&party==88620
		replace party_perc2=(11.7*(date("31121997", "DMY")-date ("31121996", "DMY")))/(72.3*365)*lrmum3 if ///
	countryname=="Lithuania"&year==1997&party==88521
		replace party_perc3=(9.5*(date("31121997", "DMY")-date ("31121996", "DMY")))/(72.3*365)*lrmum3 if ///
	countryname=="Lithuania"&year==1997&party==88420
	
		replace party_perc=(51.1*(date("31121998", "DMY")-date ("31121997", "DMY")))/(72.3*365)*lrmum3 if ///
	countryname=="Lithuania"&year==1998&party==88620
		replace party_perc2=(11.7*(date("31121998", "DMY")-date ("31121997", "DMY")))/(72.3*365)*lrmum3 if ///
	countryname=="Lithuania"&year==1998&party==88521
		replace party_perc3=(9.5*(date("31121998", "DMY")-date ("31121997", "DMY")))/(72.3*365)*lrmum3 if ///
	countryname=="Lithuania"&year==1998&party==88420
	
		replace party_perc=(51.1*(date("31121999", "DMY")-date ("31121998", "DMY")))/(72.3*365)*lrmum3 if ///
	countryname=="Lithuania"&year==1999&party==88620
		replace party_perc2=(11.7*(date("31121999", "DMY")-date ("31121998", "DMY")))/(72.3*365)*lrmum3 if ///
	countryname=="Lithuania"&year==1999&party==88521
		replace party_perc3=(9.5*(date("31121999", "DMY")-date ("31121998", "DMY")))/(72.3*365)*lrmum3 if ///
	countryname=="Lithuania"&year==1999&party==88420
	
					replace number_parties=3 if countryname=="Lithuania"& year==1997
					replace number_parties=3 if countryname=="Lithuania"& year==1998
					replace number_parties=3 if countryname=="Lithuania"& year==1999
	
	***2000 change in gov on 27/10/2000 following elections
	*first the old coalitition
		replace party_perc=(51.1*(date("27102000", "DMY")-date ("31121999", "DMY")))/(72.3*366)*lrmum3[_n-1] if ///
	countryname=="Lithuania"&year==2000&party[_n-1]==88620
		replace party_perc2=(11.7*(date("27102000", "DMY")-date ("31121999", "DMY")))/(72.3*366)*lrmum3[_n-1] if ///
	countryname=="Lithuania"&year==2000&party[_n-1]==88521
		replace party_perc3=(9.5*(date("27102000", "DMY")-date ("31121999", "DMY")))/(72.3*366)*lrmum3[_n-1] if ///
	countryname=="Lithuania"&year==2000&party[_n-1]==88420
	
	*second coalition lls and ns-sl
		replace party_perc4=(23.4*(date("31122000", "DMY")-date ("27102000", "DMY")))/(43.3*366)*lrmum3 if ///
	countryname=="Lithuania"&year==2000&party==88422
		replace party_perc5=(19.9*(date("31122000", "DMY")-date ("27102000", "DMY")))/(43.3*366)*lrmum3 if ///
	countryname=="Lithuania"&year==2000&party==88410
	
					replace number_parties=(date("27102000", "DMY")-date ("31121999", "DMY"))/366*3+ ///
					(date("31122000", "DMY")-date ("27102000", "DMY"))/366*2  if countryname=="Lithuania"& year==2000
					*ns-sl is only one party
	
	****2001 change on 05/07 without elections
	**first last coalition
		replace party_perc4=(23.4*(date("05072001", "DMY")-date ("31122000", "DMY")))/(43.3*365)*lrmum3 if ///
	countryname=="Lithuania"&year==2001&party==88422
		replace party_perc5=(19.9*(date("05072001", "DMY")-date ("31122000", "DMY")))/(43.3*366)*lrmum3 if ///
	countryname=="Lithuania"&year==2001&party==88410	
	*second coalition formed of lsdp(34) ns-sl(19.9); in 2000 lsdp is as brazauskas(88321)
	
		replace party_perc=(34*(date("31122001", "DMY")-date ("05072001", "DMY")))/(53.9*365)*lrmum3 if ///
	countryname=="Lithuania"&year==2001&party==88321
		replace party_perc2=(19.9*(date("31122001", "DMY")-date ("05072001", "DMY")))/(53.9*365)*lrmum3 if ///
	countryname=="Lithuania"&year==2001&party==88410
	
					replace number_parties=2 if countryname=="Lithuania"& year==2001

	
	**2002 and 2003 no changes
		replace party_perc=(34*(date("31122002", "DMY")-date ("31122001", "DMY")))/(53.9*365)*lrmum3 if ///
	countryname=="Lithuania"&year==2002&party==88321
		replace party_perc2=(19.9*(date("31122002", "DMY")-date ("31122001", "DMY")))/(53.9*365)*lrmum3 if ///
	countryname=="Lithuania"&year==2002&party==88410
	
		replace party_perc=(34*(date("31122002", "DMY")-date ("31122001", "DMY")))/(53.9*365)*lrmum3 if ///
	countryname=="Lithuania"&year==2003&party==88321
		replace party_perc2=(19.9*(date("31122002", "DMY")-date ("31122001", "DMY")))/(53.9*365)*lrmum3 if ///
	countryname=="Lithuania"&year==2003&party==88410

					replace number_parties=2 if countryname=="Lithuania"& year==2002
					replace number_parties=2 if countryname=="Lithuania"& year==2003

	
	**2004change in gov on 14/12/2004 following elections
	*first the old coalition
		replace party_perc=(34*(date("14122004", "DMY")-date ("31122003", "DMY")))/(53.9*365)*lrmum3[_n-1] if ///
	countryname=="Lithuania"&year==2004&party[_n-1]==88321
		replace party_perc2=(19.9*(date("14122004", "DMY")-date ("31122003", "DMY")))/(53.9*365)*lrmum3[_n-1] if ///
	countryname=="Lithuania"&year==2004&party[_n-1]==88410
	
	*new coalition dp, lsdp, ns-sl, lppu
		replace party_perc3=(27.7*(date("31122004", "DMY")-date ("14122004", "DMY")))/(56.8*366)*lrmum3 if ///
	countryname=="Lithuania"&year==2004&party==88440
		replace party_perc4=(14.2*(date("31122004", "DMY")-date ("14122004", "DMY")))/(56.8*366)*lrmum3 if ///
	countryname=="Lithuania"&year==2004&party==88031
		replace party_perc5=(7.8*(date("31122004", "DMY")-date ("14122004", "DMY")))/(56.8*366)*lrmum3 if ///
	countryname=="Lithuania"&year==2004&party==88031
		replace party_perc6=(7.1*(date("31122004", "DMY")-date ("14122004", "DMY")))/(56.8*366)*lrmum3 if ///
	countryname=="Lithuania"&year==2004&party==88820
	
	
					replace number_parties=(date("14122004", "DMY")-date ("31122003", "DMY"))/366*2+ ///
					(date("31122004", "DMY")-date ("14122004", "DMY"))/366*4 if countryname=="Lithuania"& year==2004
	
	
	
	****POLAND	
	
	*1992 change in gov on 11/07/1992 without elections
	*first old coalition
		replace party_perc=(9.6*(date("11071992", "DMY")-date ("31121991", "DMY")))/(26.4*366)*lrmum3 if ///
	countryname=="Poland"&year==1992&party==92521
		replace party_perc2=(10.7*(date("11071992", "DMY")-date ("31121991", "DMY")))/(26.4*366)*lrmum3 if ///
	countryname=="Poland"&year==1992&party==92530
		replace party_perc3=(6.1*(date("11071992", "DMY")-date ("31121991", "DMY")))/(26.4*366)*lrmum3 if ///
	countryname=="Poland"&year==1992&party==92810
	
	*second coalition: ud, zchn, kld, pl, pchd, slch (with 0 seats, so i wont add bc you cant divide by 0)
		replace party_perc4=(13.5*(date("31121992", "DMY")-date ("11071992", "DMY")))/(39.4*366)*lrmum3 if ///
	countryname=="Poland"&year==1992&party==92410
		replace party_perc5=(10.7*(date("31121992", "DMY")-date ("11071992", "DMY")))/(39.4*366)*lrmum3 if ///
	countryname=="Poland"&year==1992&party==92530
		replace party_perc6=(8*(date("31121992", "DMY")-date ("11071992", "DMY")))/(39.4*366)*lrmum3 if ///
	countryname=="Poland"&year==1992&party==92420
		replace party_perc7=(6.1*(date("31121992", "DMY")-date ("11071992", "DMY")))/(39.4*366)*lrmum3 if ///
	countryname=="Poland"&year==1992&party==92810
		replace party_perc8=(1.1*(date("31121992", "DMY")-date ("11071992", "DMY")))/(39.4*366)*lrmum3 if ///
	countryname=="Poland"&year==1992&party==92522
	
					replace number_parties=(date("11071992", "DMY")-date ("31121991", "DMY"))/366*3+ ///
					(date("31121992", "DMY")-date ("11071992", "DMY"))/366*5 if countryname=="Poland"& year==1992
	
	
	*1993 change on 19/09/1993 following elections
	*first old coalition
		replace party_perc=(13.5*(date("19091993", "DMY")-date ("31121992", "DMY")))/(39.4*365)*lrmum3[_n-1] if ///
	countryname=="Poland"&year==1993&party[_n-1]==92410
		replace party_perc2=(10.7*(date("19091993", "DMY")-date ("31121992", "DMY")))/(39.4*365)*lrmum3[_n-1] if ///
	countryname=="Poland"&year==1993&party[_n-1]==92530
		replace party_perc3=(8*(date("19091993", "DMY")-date ("31121992", "DMY")))/(39.4*365)*lrmum3[_n-1] if ///
	countryname=="Poland"&year==1993&party[_n-1]==92420
		replace party_perc4=(6.1*(date("19091993", "DMY")-date ("31121992", "DMY")))/(39.4*365)*lrmum3[_n-1] if ///
	countryname=="Poland"&year==1993&party[_n-1]==92810
		replace party_perc5=(1.1*(date("19091993", "DMY")-date ("31121992", "DMY")))/(39.4*365)*lrmum3[_n-1] if ///
	countryname=="Poland"&year==1993&party[_n-1]==92522
	
	*new coalition sld and psl
		replace party_perc6=(37.2*(date("31121993", "DMY")-date ("19091993", "DMY")))/(65.9*365)*lrmum3 if ///
	countryname=="Poland"&year==1993&party==92210
		replace party_perc7=(28.7*(date("31121993", "DMY")-date ("19091993", "DMY")))/(65.9*365)*lrmum3 if ///
	countryname=="Poland"&year==1993&party==92811
	
					replace number_parties=(date("19091993", "DMY")-date ("31121992", "DMY"))/365*5+ ///
					(date("31121993", "DMY")-date ("19091993", "DMY"))/365*2 if countryname=="Poland"& year==1993
	
	***1994-1996 same coalition; WONT CHANGE THE DATES OF INVESTITURE, because IT DOESN'T MATTER; ITS A WHOLE YEAR
		replace party_perc=(37.2*(date("31121993", "DMY")-date ("31121992", "DMY")))/(65.9*365)*lrmum3 if ///
	countryname=="Poland"&year==1994&party==92210
		replace party_perc2=(28.7*(date("31121993", "DMY")-date ("31121992", "DMY")))/(65.9*365)*lrmum3 if ///
	countryname=="Poland"&year==1994&party==92811
	
					replace number_parties=2 if countryname=="Poland"& year==1994

	
			replace party_perc=(37.2*(date("31121993", "DMY")-date ("31121992", "DMY")))/(65.9*365)*lrmum3 if ///
	countryname=="Poland"&year==1995&party==92210
		replace party_perc2=(28.7*(date("31121993", "DMY")-date ("31121992", "DMY")))/(65.9*365)*lrmum3 if ///
	countryname=="Poland"&year==1995&party==92811

					replace number_parties=2 if countryname=="Poland"& year==1995

	
			replace party_perc=(37.2*(date("31121993", "DMY")-date ("31121992", "DMY")))/(65.9*365)*lrmum3 if ///
	countryname=="Poland"&year==1996&party==92210
		replace party_perc2=(28.7*(date("31121993", "DMY")-date ("31121992", "DMY")))/(65.9*365)*lrmum3 if ///
	countryname=="Poland"&year==1996&party==92811
	
					replace number_parties=2 if countryname=="Poland"& year==1996

	
	**1997 change in gov on 31/10/1997 following elections
	*first the old coalition
		replace party_perc=(37.2*(date("31101997", "DMY")-date ("31121996", "DMY")))/(65.9*365)*lrmum3[_n-1] if ///
	countryname=="Poland"&year==1997&party[_n-1]==92210
		replace party_perc2=(28.7*(date("31101997", "DMY")-date ("31121996", "DMY")))/(65.9*365)*lrmum3[_n-1] if ///
	countryname=="Poland"&year==1997&party[_n-1]==92811
	
	*new coalition aws and uw
		replace party_perc3=(43.7*(date("31121997", "DMY")-date ("31101997", "DMY")))/(56.7*365)*lrmum3 if ///
	countryname=="Poland"&year==1997&party==92620
		replace party_perc4=(13*(date("31121997", "DMY")-date ("31101997", "DMY")))/(56.7*365)*lrmum3 if ///
	countryname=="Poland"&year==1997&party==92434

					replace number_parties=2 if countryname=="Poland"& year==1997

	
	**1998 and 1999 same coalition; WONT CHANGE THE YEARS
		replace party_perc=(43.7*(date("31121997", "DMY")-date ("31121996", "DMY")))/(56.7*365)*lrmum3 if ///
	countryname=="Poland"&year==1998&party==92620
		replace party_perc2=(13*(date("31121997", "DMY")-date ("31121996", "DMY")))/(56.7*365)*lrmum3 if ///
	countryname=="Poland"&year==1998&party==92434
	
					replace number_parties=2 if countryname=="Poland"& year==1998

	
		replace party_perc=(43.7*(date("31121997", "DMY")-date ("31121996", "DMY")))/(56.7*365)*lrmum3 if ///
	countryname=="Poland"&year==1999&party==92620
		replace party_perc2=(13*(date("31121997", "DMY")-date ("31121996", "DMY")))/(56.7*365)*lrmum3 if ///
	countryname=="Poland"&year==1999&party==92434
	
					replace number_parties=2 if countryname=="Poland"& year==1999

	
	*2000 change in gov on 29/06/2000 without elections
	*first the old coalition
		replace party_perc=(43.7*(date("29062000", "DMY")-date ("31121999", "DMY")))/(56.7*366)*lrmum3 if ///
	countryname=="Poland"&year==2000&party==92620
		replace party_perc2=(13*(date("29062000", "DMY")-date ("31121999", "DMY")))/(56.7*366)*lrmum3 if ///
	countryname=="Poland"&year==2000&party==92434
	
	*new coalition, just aws
		replace party_perc3=(43.7*(date("31122000", "DMY")-date ("29062000", "DMY")))/(43.7*366)*lrmum3 if ///
	countryname=="Poland"&year==2000&party==92620
	
					replace number_parties=(date("29062000", "DMY")-date ("31121999", "DMY"))/366*2+ ///
					(date("31122000", "DMY")-date ("29062000", "DMY"))/366*1 if countryname=="Poland"& year==2000
	
	*2001 change in gov on 19/10/2001 following elections sld, up, psl
	*first the old coalition
		replace party_perc=(43.7*(date("19102001", "DMY")-date ("31122000", "DMY")))/(43.7*365)*lrmum3[_n-1] if ///
	countryname=="Poland"&year==2001&party[_n-1]==92620
	
	*second  coalition
		replace party_perc2=(43.5*(date("31122001", "DMY")-date ("19102001", "DMY")))/(56.1*365)*lrmum3 if ///
	countryname=="Poland"&year==2001&party==92212
		replace party_perc3=(3.5*(date("31122001", "DMY")-date ("19102001", "DMY")))/(56.1*365)*lrmum3 if ///
	countryname=="Poland"&year==2001&party==92212
		replace party_perc4=(9.1*(date("31122001", "DMY")-date ("19102001", "DMY")))/(56.1*365)*lrmum3 if ///
	countryname=="Poland"&year==2001&party==92811
	
					replace number_parties=(date("19102001", "DMY")-date ("31122000", "DMY"))/365*1+ ///
					(date("31122001", "DMY")-date ("19102001", "DMY"))/365*3 if countryname=="Poland"& year==2001
					
	*2002 same coalition
		replace party_perc=(43.5*(date("31122002", "DMY")-date ("31122001", "DMY")))/(56.1*365)*lrmum3 if ///
	countryname=="Poland"&year==2002&party==92212
		replace party_perc2=(3.5*(date("31122002", "DMY")-date ("31122001", "DMY")))/(56.1*365)*lrmum3 if ///
	countryname=="Poland"&year==2002&party==92212
		replace party_perc3=(9.1*(date("31122002", "DMY")-date ("31122001", "DMY")))/(56.1*365)*lrmum3 if ///
	countryname=="Poland"&year==2002&party==92811
	
					replace number_parties=3 if countryname=="Poland"& year==2002

	
	*2003 change on 03/03/2003 without elections
	*first the old coalition
		replace party_perc=(43.5*(date("03032003", "DMY")-date ("31122002", "DMY")))/(56.1*365)*lrmum3 if ///
	countryname=="Poland"&year==2003&party==92212
		replace party_perc2=(3.5*(date("03032003", "DMY")-date ("31122002", "DMY")))/(56.1*365)*lrmum3 if ///
	countryname=="Poland"&year==2003&party==92212
		replace party_perc3=(9.1*(date("03032003", "DMY")-date ("31122002", "DMY")))/(56.1*365)*lrmum3 if ///
	countryname=="Poland"&year==2003&party==92811
	
	*second coalition drops psl
		replace party_perc4=(43.5*(date("31122003", "DMY")-date ("03032003", "DMY")))/(47*365)*lrmum3 if ///
	countryname=="Poland"&year==2003&party==92212
		replace party_perc5=(3.5*(date("31122003", "DMY")-date ("03032003", "DMY")))/(47*365)*lrmum3 if ///
	countryname=="Poland"&year==2003&party==92212
	
					replace number_parties=(date("03032003", "DMY")-date ("31122002", "DMY"))/365*3+ ///
					(date("31122003", "DMY")-date ("03032003", "DMY"))/365*2 if countryname=="Poland"& year==2003
	
	***2004 change in coalition on 15/07/2004, it adds sdpl but it has 0 seats, so i wont even bother
		
		replace party_perc=(43.5*(date("31122004", "DMY")-date ("31122003", "DMY")))/(47*366)*lrmum3 if ///
	countryname=="Poland"&year==2004&party==92212
		replace party_perc2=(3.5*(date("31122004", "DMY")-date ("31122003", "DMY")))/(47*366)*lrmum3 if ///
	countryname=="Poland"&year==2004&party==92212
	
					replace number_parties=2 if countryname=="Poland"& year==2004

	
	****ROMANIA
	* first elections in 1990
	
	*1991 change in gov on 16/10/1991
	*the old coalition first, nsf
		replace party_perc=(66.4*(date("16101991", "DMY")-date ("31121990", "DMY")))/(66.4*365)*lrmum3 if ///
	countryname=="Romania"&year==1991&party==93221
	
	*new coalition nsf, pnl, mer, pdar
		replace party_perc2=(66.4*(date("31121991", "DMY")-date ("16101991", "DMY")))/(79*365)*lrmum3 if ///
	countryname=="Romania"&year==1991&party==93221
		replace party_perc2=(7.3*(date("31121991", "DMY")-date ("16101991", "DMY")))/(79*365)*lrmum3 if ///
	countryname=="Romania"&year==1991&party==93411
		replace party_perc2=(3*(date("31121991", "DMY")-date ("16101991", "DMY")))/(79*365)*lrmum3 if ///
	countryname=="Romania"&year==1991&party==93111
		replace party_perc2=(2.3*(date("31121991", "DMY")-date ("16101991", "DMY")))/(79*365)*lrmum3 if ///
	countryname=="Romania"&year==1991&party==93810
	
					replace number_parties=(date("16101991", "DMY")-date ("31121990", "DMY"))/365*1+ ///
					(date("31121991", "DMY")-date ("16101991", "DMY"))/365*4 if countryname=="Romania"& year==1991
	
	*1992 change on 13/11/1992 only nsf remains after elections
	*first the old coalition
		replace party_perc=(66.4*(date("13111992", "DMY")-date ("31121991", "DMY")))/(79*366)*lrmum3[_n-1] if ///
	countryname=="Romania"&year==1992&party==93221
		replace party_perc=(7.3*(date("13111992", "DMY")-date ("31121991", "DMY")))/(79*366)*lrmum3[_n-1] if ///
	countryname=="Romania"&year==1992&party==93411
		replace party_perc=(3*(date("13111992", "DMY")-date ("31121991", "DMY")))/(79*366)*lrmum3[_n-1] if ///
	countryname=="Romania"&year==1992&party==93111
		replace party_perc=(2.3*(date("13111992", "DMY")-date ("31121991", "DMY")))/(79*366)*lrmum3[_n-1] if ///
	countryname=="Romania"&year==1992&party==93810
	
	**second coalition 
		replace party_perc2=(34.3*(date("31121992", "DMY")-date ("13111992", "DMY")))/(34.3*366)*lrmum3 if ///
	countryname=="Romania"&year==1992&party==93221
	
					replace number_parties=(date("13111992", "DMY")-date ("31121991", "DMY"))/366*4+ ///
					(date("31121992", "DMY")-date ("13111992", "DMY"))/366*1 if countryname=="Romania"& year==1992
	
	*1993 no change 
		replace party_perc=(34.3*(date("31121993", "DMY")-date ("31121992", "DMY")))/(34.3*365)*lrmum3 if ///
	countryname=="Romania"&year==1993&party==93221
	
					replace number_parties=1 if countryname=="Romania"& year==1993

	
	*1994 change on 06/03/1994 pdsr+ punr without elections
	*first the old coalition
		replace party_perc=(34.3*(date("06031994", "DMY")-date ("31121993", "DMY")))/(34.3*365)*lrmum3 if ///
	countryname=="Romania"&year==1994&party==93221
	
	*second coalition
		replace party_perc2=(34.3*(date("31121994", "DMY")-date ("06031994", "DMY")))/(43.1*365)*lrmum3 if ///
	countryname=="Romania"&year==1994&party==93223
		replace party_perc3=(8.8*(date("31121994", "DMY")-date ("06031994", "DMY")))/(43.1*365)*lrmum3 if ///
	countryname=="Romania"&year==1994&party==93711
	
					replace number_parties=(date("06031994", "DMY")-date ("31121993", "DMY"))/365*1+ ///
					(date("31121994", "DMY")-date ("06031994", "DMY"))/365*2 if countryname=="Romania"& year==1994
	
	*1995 nothing changes
		replace party_perc=(34.3*(date("31121995", "DMY")-date ("31121994", "DMY")))/(43.1*365)*lrmum3 if ///
	countryname=="Romania"&year==1995&party==93223
		replace party_perc2=(8.8*(date("31121995", "DMY")-date ("31121994", "DMY")))/(43.1*365)*lrmum3 if ///
	countryname=="Romania"&year==1995&party==93711
	
					replace number_parties=2 if countryname=="Romania"& year==1995

	
	*1996: two changes, first before elections second after 03/09/1996 and 12/12/1996
	*the old coalition first
		replace party_perc=(34.3*(date("03091996", "DMY")-date ("31121995", "DMY")))/(43.1*366)*lrmum3[_n-1] if ///
	countryname=="Romania"&year==1996&party[_n-1]==93223
		replace party_perc2=(8.8*(date("03091996", "DMY")-date ("31121995", "DMY")))/(43.1*366)*lrmum3[_n-1] if ///
	countryname=="Romania"&year==1996&party[_n-1]==93711
	
	*second coalition
		replace party_perc3=(34.3*(date("12121996", "DMY")-date ("03091996", "DMY")))/(34.3*366)*lrmum3[_n-1] if ///
	countryname=="Romania"&year==1996&party[_n-1]==93223
	
	*third coalition cdr pd udmr
		replace party_perc4=(35.6*(date("31121996", "DMY")-date ("12121996", "DMY")))/(58.4*366)*lrmum3 if ///
	countryname=="Romania"&year==1996&party==93411
		replace party_perc5=(15.5*(date("31121996", "DMY")-date ("12121996", "DMY")))/(58.4*366)*lrmum3 if ///
	countryname=="Romania"&year==1996&party==93322
		replace party_perc6=(7.3*(date("31121996", "DMY")-date ("12121996", "DMY")))/(58.4*366)*lrmum3 if ///
	countryname=="Romania"&year==1996&party==93951
	
					replace number_parties=(date("03091996", "DMY")-date ("31121995", "DMY"))/366*2+ ///
					(date("12121996", "DMY")-date ("03091996", "DMY"))/366*1+ ///
					(date("31121996", "DMY")-date ("12121996", "DMY"))/366*3 if countryname=="Romania"& year==1996
					***CD is only one party, that's debatable; may come back
	
	*1997 same coalition
		replace party_perc=(35.6*(date("31121997", "DMY")-date ("31121996", "DMY")))/(58.4*365)*lrmum3 if ///
	countryname=="Romania"&year==1997&party==93411
		replace party_perc2=(15.5*(date("31121997", "DMY")-date ("31121996", "DMY")))/(58.4*365)*lrmum3 if ///
	countryname=="Romania"&year==1997&party==93322
		replace party_perc3=(7.3*(date("31121997", "DMY")-date ("31121996", "DMY")))/(58.4*365)*lrmum3 if ///
	countryname=="Romania"&year==1997&party==93951
	
					replace number_parties=3 if countryname=="Romania"& year==1997
				***CD is only one party, that's debatable; may come back

	
	*1998 change on 15/04/1998 without elections
	*first the old coalition
		replace party_perc=(35.6*(date("15041998", "DMY")-date ("31121997", "DMY")))/(58.4*365)*lrmum3 if ///
	countryname=="Romania"&year==1998&party==93411
		replace party_perc2=(15.5*(date("15041998", "DMY")-date ("31121997", "DMY")))/(58.4*365)*lrmum3 if ///
	countryname=="Romania"&year==1998&party==93322
		replace party_perc3=(7.3*(date("15041998", "DMY")-date ("31121997", "DMY")))/(58.4*365)*lrmum3 if ///
	countryname=="Romania"&year==1998&party==93951
	
	*new coalition: cdr pdsr udmr
		replace party_perc4=(35.6*(date("31121998", "DMY")-date ("15041998", "DMY")))/(69.5*365)*lrmum3 if ///
	countryname=="Romania"&year==1998&party==93411
		replace party_perc5=(26.6*(date("31121998", "DMY")-date ("15041998", "DMY")))/(69.5*365)*lrmum3 if ///
	countryname=="Romania"&year==1998&party==93223	
		replace party_perc6=(7.3*(date("31121998", "DMY")-date ("15041998", "DMY")))/(69.5*365)*lrmum3 if ///
	countryname=="Romania"&year==1998&party==93951
	
					replace number_parties=3 if countryname=="Romania"& year==1998
				***CD is only one party, that's debatable; may come back


	
	*1999 change without elections on 12/12/1999, PD is brought back to replace pdsr
	*first the old coalition
		replace party_perc=(35.6*(date("12121999", "DMY")-date ("31121998", "DMY")))/(69.5*365)*lrmum3 if ///
	countryname=="Romania"&year==1999&party==93411
		replace party_perc2=(26.6*(date("12121999", "DMY")-date ("31121998", "DMY")))/(69.5*365)*lrmum3 if ///
	countryname=="Romania"&year==1999&party==93223	
		replace party_perc3=(7.3*(date("12121999", "DMY")-date ("31121998", "DMY")))/(69.5*365)*lrmum3 if ///
	countryname=="Romania"&year==1999&party==93951
	
	*second coalition
		replace party_perc4=(35.6*(date("31121999", "DMY")-date ("12121999", "DMY")))/(58.4*365)*lrmum3 if ///
	countryname=="Romania"&year==1999&party==93411
		replace party_perc5=(15.5*(date("31121999", "DMY")-date ("12121999", "DMY")))/(58.4*365)*lrmum3 if ///
	countryname=="Romania"&year==1999&party==93322
		replace party_perc6=(7.3*(date("31121999", "DMY")-date ("12121999", "DMY")))/(58.4*365)*lrmum3 if ///
	countryname=="Romania"&year==1999&party==93951

					replace number_parties=3 if countryname=="Romania"& year==1999
				***CD is only one party, that's debatable; may come back
	
	*2000 change in gov at 28/12/2000 following elections: pdsr all the way
	*first the old coalition
		replace party_perc=(35.6*(date("28122000", "DMY")-date ("31121999", "DMY")))/(58.4*366)*lrmum3[_n-1] if ///
	countryname=="Romania"&year==2000&party[_n-1]==93411
		replace party_perc2=(15.5*(date("28122000", "DMY")-date ("31121999", "DMY")))/(58.4*366)*lrmum3[_n-1] if ///
	countryname=="Romania"&year==2000&party[_n-1]==93322
		replace party_perc3=(7.3*(date("28122000", "DMY")-date ("31121999", "DMY")))/(58.4*366)*lrmum3[_n-1] if ///
	countryname=="Romania"&year==2000&party[_n-1]==93951
	
	*second coalition
		replace party_perc4=(44.9*(date("31122000", "DMY")-date ("28122000", "DMY")))/(44.9*366)*lrmum3 if ///
	countryname=="Romania"&year==2000&party==93223
	
					replace number_parties=(date("28122000", "DMY")-date ("31121999", "DMY"))/366*3+ ///
					(date("31122000", "DMY")-date ("28122000", "DMY"))/366*1 if countryname=="Romania"& year==2000
	
	*2001 to 2003 same coalition
		replace party_perc=(44.9*(date("31122001", "DMY")-date ("31122000", "DMY")))/(44.9*365)*lrmum3 if ///
	countryname=="Romania"&year==2001&party==93223
		replace party_perc=(44.9*(date("31122001", "DMY")-date ("31122000", "DMY")))/(44.9*365)*lrmum3 if ///
	countryname=="Romania"&year==2002&party==93223
		replace party_perc=(44.9*(date("31122001", "DMY")-date ("31122000", "DMY")))/(44.9*365)*lrmum3 if ///
	countryname=="Romania"&year==2003&party==93223
	
					replace number_parties=1 if countryname=="Romania"& year==2001
					replace number_parties=1 if countryname=="Romania"& year==2002
					replace number_parties=1 if countryname=="Romania"& year==2003

	
	*2004 change on 29/12/2004 following elections
	*first the old coalition
		replace party_perc=(44.9*(date("29122004", "DMY")-date ("31122003", "DMY")))/(44.9*366)*lrmum3[_n-1] if ///
	countryname=="Romania"&year==2004&party[_n-1]==93223
	
	*second coalition: pnl pd udmr pur
		replace party_perc2=(19.2*(date("31122004", "DMY")-date ("29122004", "DMY")))/(46*366)*lrmum3 if ///
	countryname=="Romania"&year==2004&party==93041
		replace party_perc3=(14.5*(date("31122004", "DMY")-date ("29122004", "DMY")))/(46*366)*lrmum3 if ///
	countryname=="Romania"&year==2004&party==93041
		replace party_perc4=(6.6*(date("31122004", "DMY")-date ("29122004", "DMY")))/(46*366)*lrmum3 if ///
	countryname=="Romania"&year==2004&party==93951
		replace party_perc5=(5.7*(date("31122004", "DMY")-date ("29122004", "DMY")))/(46*366)*lrmum3 if ///
	countryname=="Romania"&year==2004&party==93001
	
					replace number_parties=(date("29122004", "DMY")-date ("31122003", "DMY"))/366*1+ ///
					(date("31122004", "DMY")-date ("29122004", "DMY"))/366*4 if countryname=="Romania"& year==2004
	
	***SLOVAKIA
	* first gov in 1990 vpn kdh ds
	*1991
		replace party_perc=(32*(date("31121991", "DMY")-date ("31121990", "DMY")))/(57.4*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1991&party==96430
		replace party_perc2=(20.7*(date("31121991", "DMY")-date ("31121990", "DMY")))/(57.4*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1991&party==96521
		replace party_perc3=(4.7*(date("31121991", "DMY")-date ("31121990", "DMY")))/(57.4*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1991&party==96420
	
					replace number_parties=3 if countryname=="Slovakia"& year==1991

	
	*1992 change on 24/06/1992 following elections
	*first the old coalition
		replace party_perc=(32*(date("24061992", "DMY")-date ("31121991", "DMY")))/(57.4*366)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==1992&party[_n-1]==96430
		replace party_perc2=(20.7*(date("24061992", "DMY")-date ("31121991", "DMY")))/(57.4*366)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==1992&party[_n-1]==96521
		replace party_perc3=(4.7*(date("24061992", "DMY")-date ("31121991", "DMY")))/(57.4*366)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==1992&party[_n-1]==96420
	
	*second coalition: hzds and sns
		replace party_perc4=(49.3*(date("31121992", "DMY")-date ("24061992", "DMY")))/(59.3*366)*lrmum3 if ///
	countryname=="Slovakia"&year==1992&party==96711
		replace party_perc5=(10*(date("31121992", "DMY")-date ("24061992", "DMY")))/(59.3*366)*lrmum3 if ///
	countryname=="Slovakia"&year==1992&party==96710
	
					replace number_parties=(date("24061992", "DMY")-date ("31121991", "DMY"))/366*3+ ///
					(date("31121992", "DMY")-date ("24061992", "DMY"))/366*2 if countryname=="Slovakia"& year==1992
	
	**1993 two changes without elections 19/03/1993 only hzds; then 17/11/93 back to both hzds and sns
	*first the old coalition
		replace party_perc=(49.3*(date("19031993", "DMY")-date ("31121992", "DMY")))/(59.3*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1993&party==96711
		replace party_perc2=(10*(date("19031993", "DMY")-date ("31121992", "DMY")))/(59.3*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1993&party==96710
	
	*second coalition
		replace party_perc3=(49.3*(date("17111993", "DMY")-date ("19031993", "DMY")))/(49.3*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1993&party==96711
	
	*third coalition brings sns back
		replace party_perc4=(49.3*(date("31121993", "DMY")-date ("17111993", "DMY")))/(59.3*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1993&party==96711
		replace party_perc5=(10*(date("31121993", "DMY")-date ("17111993", "DMY")))/(59.3*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1993&party==96710
	
	
					replace number_parties=(date("19031993", "DMY")-date ("31121992", "DMY"))/365*2+ ///
					(date("17111993", "DMY")-date ("19031993", "DMY"))/365*1+ ///
					(date("31121993", "DMY")-date ("17111993", "DMY"))/365*2 if countryname=="Slovakia"& year==1993
	
	*1994 two changes one without elections on 16/03/1994; one following elections on 12/12/1994
	*first the old coalition
		replace party_perc=(49.3*(date("16031994", "DMY")-date ("31121993", "DMY")))/(59.3*365)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==1994&party[_n-1]==96711&party==96711
		replace party_perc2=(10*(date("16031994", "DMY")-date ("31121993", "DMY")))/(59.3*365)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==1994&party[_n-1]==96710
	
	*second coalition sdl kdh adsr dus(splinter from hzds) nds(splinter from sns)
		replace party_perc3=(19.3*(date("12121994", "DMY")-date ("16031994", "DMY")))/(44.6*365)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==1994&party[_n-1]==96220&party==96220
			replace party_perc4=(12*(date("12121994", "DMY")-date ("16031994", "DMY")))/(44.6*365)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==1994&party[_n-1]==96521
			replace party_perc5=(5.3*(date("12121994", "DMY")-date ("16031994", "DMY")))/(44.6*365)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==1994&party[_n-1]==96431
			replace party_perc6=(4.7*(date("12121994", "DMY")-date ("16031994", "DMY")))/(44.6*365)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==1994&party[_n-1]==96711&party==96711
			replace party_perc7=(3.3*(date("12121994", "DMY")-date ("16031994", "DMY")))/(44.6*365)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==1994&party[_n-1]==96710
	
	*third coaltion hzds zrs sns
		replace party_perc8=(40.5*(date("31121994", "DMY")-date ("12121994", "DMY")))/(54.6*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1994&party==96711
		replace party_perc9=(8.1*(date("31121994", "DMY")-date ("12121994", "DMY")))/(54.6*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1994&party==96210
		replace party_perc10=(6*(date("31121994", "DMY")-date ("12121994", "DMY")))/(54.6*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1994&party==96710
	
					replace number_parties=(date("16031994", "DMY")-date ("31121993", "DMY"))/365*2+ ///
					(date("12121994", "DMY")-date ("16031994", "DMY"))/365*5+ ///
					(date("31121994", "DMY")-date ("12121994", "DMY"))/365*3 if countryname=="Slovakia"& year==1994
	
	*1995 to 1997 same coalition
		replace party_perc=(40.5*(date("31121995", "DMY")-date ("31121994", "DMY")))/(54.6*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1995&party==96711
		replace party_perc2=(8.1*(date("31121995", "DMY")-date ("31121994", "DMY")))/(54.6*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1995&party==96210
		replace party_perc3=(6*(date("31121995", "DMY")-date ("31121994", "DMY")))/(54.6*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1995&party==96710
	
					replace number_parties=3 if countryname=="Slovakia"& year==1995

	
		replace party_perc=(40.5*(date("31121995", "DMY")-date ("31121994", "DMY")))/(54.6*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1996&party==96711
		replace party_perc2=(8.1*(date("31121995", "DMY")-date ("31121994", "DMY")))/(54.6*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1996&party==96210
		replace party_perc3=(6*(date("31121995", "DMY")-date ("31121994", "DMY")))/(54.6*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1996&party==96710
	
					replace number_parties=3 if countryname=="Slovakia"& year==1996

		replace party_perc=(40.5*(date("31121995", "DMY")-date ("31121994", "DMY")))/(54.6*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1997&party==96711
		replace party_perc2=(8.1*(date("31121995", "DMY")-date ("31121994", "DMY")))/(54.6*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1997&party==96210
		replace party_perc3=(6*(date("31121995", "DMY")-date ("31121994", "DMY")))/(54.6*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1997&party==96710
	
					replace number_parties=3 if countryname=="Slovakia"& year==1997

	
	*1998 new coalition on 30/11/1998 following elections sdk sdl smk sop
	*first old coalition
		replace party_perc=(40.5*(date("30111998", "DMY")-date ("31121997", "DMY")))/(54.6*365)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==1998&party[_n-1]==96711
		replace party_perc2=(8.1*(date("30111998", "DMY")-date ("31121997", "DMY")))/(54.6*365)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==1998&party[_n-1]==96210
		replace party_perc3=(6*(date("30111998", "DMY")-date ("31121997", "DMY")))/(54.6*365)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==1998&party[_n-1]==96710
	
	*second coalition
		replace party_perc4=(28*(date("31121998", "DMY")-date ("30111998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1998&party==96522
		replace party_perc5=(15.3*(date("31121998", "DMY")-date ("30111998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1998&party==96220
		replace party_perc6=(10*(date("31121998", "DMY")-date ("30111998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1998&party==96952
		replace party_perc7=(8.7*(date("31121998", "DMY")-date ("30111998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1998&party==96422
	
					replace number_parties=(date("30111998", "DMY")-date ("31121997", "DMY"))/365*3+ ///
					(date("31121998", "DMY")-date ("30111998", "DMY"))/365*4 if countryname=="Slovakia"& year==1998
	
	*1999-2001 same coalition
		replace party_perc=(28*(date("31121999", "DMY")-date ("31121998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1999&party==96522
		replace party_perc2=(15.3*(date("31121999", "DMY")-date ("31121998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1999&party==96220
		replace party_perc3=(10*(date("31121999", "DMY")-date ("31121998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1999&party==96952
		replace party_perc4=(8.7*(date("31121999", "DMY")-date ("31121998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==1999&party==96422
	
		replace party_perc=(28*(date("31121999", "DMY")-date ("31121998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2000&party==96522
		replace party_perc2=(15.3*(date("31121999", "DMY")-date ("31121998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2000&party==96220
		replace party_perc3=(10*(date("31121999", "DMY")-date ("31121998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2000&party==96952
		replace party_perc4=(8.7*(date("31121999", "DMY")-date ("31121998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2000&party==96422

		replace party_perc=(28*(date("31121999", "DMY")-date ("31121998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2001&party==96522
		replace party_perc2=(15.3*(date("31121999", "DMY")-date ("31121998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2001&party==96220
		replace party_perc3=(10*(date("31121999", "DMY")-date ("31121998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2001&party==96952
		replace party_perc4=(8.7*(date("31121999", "DMY")-date ("31121998", "DMY")))/(62*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2001&party==96422
	
					replace number_parties=4 if countryname=="Slovakia"& year==1999
					replace number_parties=4 if countryname=="Slovakia"& year==2000
					replace number_parties=4 if countryname=="Slovakia"& year==2001

	
	*2002 change in gov on 16/11/2002 following elections
	*first the old coalition
		replace party_perc=(28*(date("16112002", "DMY")-date ("31122001", "DMY")))/(62*365)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==2002&party[_n-1]==96522
		replace party_perc2=(15.3*(date("16112002", "DMY")-date ("31122001", "DMY")))/(62*365)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==2002&party[_n-1]==96220
		replace party_perc3=(10*(date("16112002", "DMY")-date ("31122001", "DMY")))/(62*365)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==2002&party[_n-1]==96952
		replace party_perc4=(8.7*(date("16112002", "DMY")-date ("31122001", "DMY")))/(62*365)*lrmum3[_n-1] if ///
	countryname=="Slovakia"&year==2002&party[_n-1]==96422
	
	*second coalition sdku smk kdh ano
		replace party_perc5=(18.7*(date("31122002", "DMY")-date ("16112002", "DMY")))/(52*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2002&party==96523
		replace party_perc6=(13.3*(date("31122002", "DMY")-date ("16112002", "DMY")))/(52*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2002&party==96952
		replace party_perc7=(10*(date("31122002", "DMY")-date ("16112002", "DMY")))/(52*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2002&party==96521
		replace party_perc8=(10*(date("31122002", "DMY")-date ("16112002", "DMY")))/(52*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2002&party==96424

					replace number_parties=4 if countryname=="Slovakia"& year==2002

	
	****2003 and 2004 same coalition
		replace party_perc=(18.7*(date("31122003", "DMY")-date ("31122002", "DMY")))/(52*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2003&party==96523
		replace party_perc2=(13.3*(date("31122003", "DMY")-date ("31122002", "DMY")))/(52*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2003&party==96952
		replace party_perc3=(10*(date("31122003", "DMY")-date ("31122002", "DMY")))/(52*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2003&party==96521
		replace party_perc4=(10*(date("31122003", "DMY")-date ("31122002", "DMY")))/(52*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2003&party==96424
	
			replace party_perc=(18.7*(date("31122003", "DMY")-date ("31122002", "DMY")))/(52*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2004&party==96523
		replace party_perc2=(13.3*(date("31122003", "DMY")-date ("31122002", "DMY")))/(52*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2004&party==96952
		replace party_perc3=(10*(date("31122003", "DMY")-date ("31122002", "DMY")))/(52*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2004&party==96521
		replace party_perc4=(10*(date("31122003", "DMY")-date ("31122002", "DMY")))/(52*365)*lrmum3 if ///
	countryname=="Slovakia"&year==2004&party==96424
	
					replace number_parties=4 if countryname=="Slovakia"& year==2003
					replace number_parties=4 if countryname=="Slovakia"& year==2004

	
	******SLOVENIA
	*first elections 1992, first gov only on 12/01/1993 
	*lds (24.5); skd (16.7); zlsd(15.6); zs (5.6); sds(4.4)
		replace party_perc=(24.5*(date("31121993", "DMY")-date ("12011993", "DMY")))/(66.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1993&party==97421
		replace party_perc2=(16.7*(date("31121993", "DMY")-date ("12011993", "DMY")))/(66.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1993&party==97520
		replace party_perc3=(15.6*(date("31121993", "DMY")-date ("12011993", "DMY")))/(66.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1993&party==97223
		replace party_perc4=(5.6*(date("31121993", "DMY")-date ("12011993", "DMY")))/(66.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1993&party==97110
		replace party_perc5=(4.4*(date("31121993", "DMY")-date ("12011993", "DMY")))/(66.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1993&party==97320
	
					replace number_parties=5 if countryname=="Slovenia"& year==1993

	*1994 change in gov without elections on 29/03/1994
	*first coalition lds skd zlsd and zs and sds
		replace party_perc=(24.5*(date("29031994", "DMY")-date ("31121993", "DMY")))/(66.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1994&party==97421
		replace party_perc2=(16.7*(date("29031994", "DMY")-date ("31121993", "DMY")))/(66.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1994&party==97520
		replace party_perc3=(15.6*(date("29031994", "DMY")-date ("31121993", "DMY")))/(66.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1994&party==97223
		replace party_perc4=(5.6*(date("29031994", "DMY")-date ("31121993", "DMY")))/(66.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1994&party==97110
		replace party_perc5=(4.4*(date("29031994", "DMY")-date ("31121993", "DMY")))/(66.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1994&party==97320
	
	*second coalition lds skd zlsd
		replace party_perc6=(24.5*(date("31121994", "DMY")-date ("29031994", "DMY")))/(56.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1994&party==97421
		replace party_perc7=(16.7*(date("31121994", "DMY")-date ("29031994", "DMY")))/(56.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1994&party==97520
		replace party_perc8=(15.6*(date("31121994", "DMY")-date ("29031994", "DMY")))/(56.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1994&party==97223
	
					replace number_parties=(date("29031994", "DMY")-date ("31121993", "DMY"))/365*5+ ///
					(date("31121994", "DMY")-date ("29031994", "DMY"))/365*3 if countryname=="Slovenia"& year==1994
	
	*1995 same coalition
		replace party_perc=(24.5*(date("31121995", "DMY")-date ("31121994", "DMY")))/(56.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1995&party==97421
		replace party_perc2=(16.7*(date("31121995", "DMY")-date ("31121994", "DMY")))/(56.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1995&party==97520
		replace party_perc3=(15.6*(date("31121995", "DMY")-date ("31121994", "DMY")))/(56.8*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1995&party==97223	
	
					replace number_parties=3 if countryname=="Slovenia"& year==1995

	
	***1996 change on 07/02/1996 without elections lds and skd; however in 1996 there are elections late in the
	*year, but i will still consider both governments based on the previous elections, so everything is at _n-1
	*first the old coalition
		replace party_perc=(24.5*(date("07021996", "DMY")-date ("31121995", "DMY")))/(56.8*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==1996&party[_n-1]==97421
		replace party_perc2=(16.7*(date("07021996", "DMY")-date ("31121995", "DMY")))/(56.8*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==1996&party[_n-1]==97520
		replace party_perc3=(15.6*(date("07021996", "DMY")-date ("31121995", "DMY")))/(56.8*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==1996&party[_n-1]==97223	
	
	*second coalition
		replace party_perc4=(24.5*(date("31121996", "DMY")-date ("07021996", "DMY")))/(41.2*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==1996&party[_n-1]==97421
		replace party_perc5=(16.7*(date("31121996", "DMY")-date ("07021996", "DMY")))/(41.2*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==1996&party[_n-1]==97520

					replace number_parties=(date("07021996", "DMY")-date ("31121995", "DMY"))/366*3+ ///
					(date("31121996", "DMY")-date ("07021996", "DMY"))/366*2 if countryname=="Slovenia"& year==1996
	
	*1997 change in gov on 07/02/1997 following elections in 1996
	*first the old coalition
		replace party_perc=(24.5*(date("07021997", "DMY")-date ("31121996", "DMY")))/(41.2*365)*lrmum3[_n-2] if ///
	countryname=="Slovenia"&year==1997&party[_n-2]==97421
		replace party_perc2=(16.7*(date("07021997", "DMY")-date ("31121996", "DMY")))/(41.2*365)*lrmum3[_n-2] if ///
	countryname=="Slovenia"&year==1997&party[_n-2]==97520
	
	*second coalition lds sls desus
		replace party_perc3=(27.8*(date("31121997", "DMY")-date ("07021997", "DMY")))/(54.5*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1997&party==97421
		replace party_perc4=(21.1*(date("31121997", "DMY")-date ("07021997", "DMY")))/(54.5*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1997&party==97521
		replace party_perc5=(5.6*(date("31121997", "DMY")-date ("07021997", "DMY")))/(54.5*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1997&party==97951
	
					replace number_parties=(date("07021997", "DMY")-date ("31121996", "DMY"))/365*2+ ///
					(date("31121997", "DMY")-date ("07021997", "DMY"))/365*3 if countryname=="Slovenia"& year==1997
	
	****1998 and 1999 same thing
		replace party_perc=(27.8*(date("31121998", "DMY")-date ("31121997", "DMY")))/(54.5*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1998&party==97421
		replace party_perc2=(21.1*(date("31121998", "DMY")-date ("31121997", "DMY")))/(54.5*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1998&party==97521
		replace party_perc3=(5.6*(date("31121998", "DMY")-date ("31121997", "DMY")))/(54.5*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1998&party==97951
	
		replace party_perc=(27.8*(date("31121998", "DMY")-date ("31121997", "DMY")))/(54.5*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1999&party==97421
		replace party_perc2=(21.1*(date("31121998", "DMY")-date ("31121997", "DMY")))/(54.5*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1999&party==97521
		replace party_perc3=(5.6*(date("31121998", "DMY")-date ("31121997", "DMY")))/(54.5*365)*lrmum3 if ///
	countryname=="Slovenia"&year==1999&party==97951
	
					replace number_parties=3 if countryname=="Slovenia"& year==1998
					replace number_parties=3 if countryname=="Slovenia"& year==1999

	
	********2000 on change on 07/06 before elections and one on 30/11 following elections
	*first the old coalition
	
		replace party_perc=(27.8*(date("07062000", "DMY")-date ("31121999", "DMY")))/(54.5*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==2000&party[_n-1]==97421
		replace party_perc2=(21.1*(date("07062000", "DMY")-date ("31121999", "DMY")))/(54.5*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==2000&party[_n-1]==97521&party==97521
		replace party_perc3=(5.6*(date("07062000", "DMY")-date ("31121999", "DMY")))/(54.5*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==2000&party[_n-1]==97951&party==97951
	
	*second coalition sls sds skd
		replace party_perc4=(21.1*(date("30112000", "DMY")-date ("07062000", "DMY")))/(50*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==2000&party[_n-1]==97521&party==97521
		replace party_perc5=(17.8*(date("30112000", "DMY")-date ("07062000", "DMY")))/(50*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==2000&party[_n-1]==97320
		replace party_perc6=(11.1*(date("30112000", "DMY")-date ("07062000", "DMY")))/(50*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==2000&party[_n-1]==97520
	
	*third coalition lds zlsd sls-skd
		replace party_perc7=(37.8*(date("31122000", "DMY")-date ("30112000", "DMY")))/(60*366)*lrmum3 if ///
	countryname=="Slovenia"&year==2000&party==97421
		replace party_perc8=(12.2*(date("31122000", "DMY")-date ("30112000", "DMY")))/(60*366)*lrmum3 if ///
	countryname=="Slovenia"&year==2000&party==97321
		replace party_perc9=(10*(date("31122000", "DMY")-date ("30112000", "DMY")))/(60*366)*lrmum3 if ///
	countryname=="Slovenia"&year==2000&party==97521
	
					replace number_parties=3 if countryname=="Slovenia"& year==2000

	
	**2001 same coalition, no change
		replace party_perc=(37.8*(date("31122001", "DMY")-date ("31122000", "DMY")))/(60*365)*lrmum3 if ///
	countryname=="Slovenia"&year==2001&party==97421
		replace party_perc2=(12.2*(date("31122001", "DMY")-date ("31122000", "DMY")))/(60*365)*lrmum3 if ///
	countryname=="Slovenia"&year==2001&party==97321
		replace party_perc3=(10*(date("31122001", "DMY")-date ("31122000", "DMY")))/(60*365)*lrmum3 if ///
	countryname=="Slovenia"&year==2001&party==97521
	
					replace number_parties=3 if countryname=="Slovenia"& year==2001

	
	*2002 change on 19/12 without elections
	*first old coalition
		replace party_perc=(37.8*(date("19122002", "DMY")-date ("31122001", "DMY")))/(60*365)*lrmum3 if ///
	countryname=="Slovenia"&year==2002&party==97421
		replace party_perc2=(12.2*(date("19122002", "DMY")-date ("31122001", "DMY")))/(60*365)*lrmum3 if ///
	countryname=="Slovenia"&year==2002&party==97321
		replace party_perc3=(10*(date("19122002", "DMY")-date ("31122001", "DMY")))/(60*365)*lrmum3 if ///
	countryname=="Slovenia"&year==2002&party==97521
	
	*second coalition just like the one above only adds desus with 4.4
		replace party_perc4=(37.8*(date("31122002", "DMY")-date ("19122002", "DMY")))/(64.4*365)*lrmum3 if ///
	countryname=="Slovenia"&year==2002&party==97421
		replace party_perc5=(12.2*(date("31122002", "DMY")-date ("19122002", "DMY")))/(64.4*365)*lrmum3 if ///
	countryname=="Slovenia"&year==2002&party==97321
		replace party_perc6=(10*(date("31122002", "DMY")-date ("19122002", "DMY")))/(64.4*365)*lrmum3 if ///
	countryname=="Slovenia"&year==2002&party==97521
		replace party_perc7=(4.4*(date("31122002", "DMY")-date ("19122002", "DMY")))/(64.4*365)*lrmum3 if ///
	countryname=="Slovenia"&year==2002&party==97951
	
					replace number_parties=(date("19122002", "DMY")-date ("31122001", "DMY"))/365*3+ ///
					(date("31122002", "DMY")-date ("19122002", "DMY"))/365*4 if countryname=="Slovenia"& year==2002
	
	**2003 same coalition
		replace party_perc=(37.8*(date("31122003", "DMY")-date ("31122002", "DMY")))/(64.4*365)*lrmum3 if ///
	countryname=="Slovenia"&year==2003&party==97421
		replace party_perc2=(12.2*(date("31122003", "DMY")-date ("31122002", "DMY")))/(64.4*365)*lrmum3 if ///
	countryname=="Slovenia"&year==2003&party==97321
		replace party_perc3=(10*(date("31122003", "DMY")-date ("31122002", "DMY")))/(64.4*365)*lrmum3 if ///
	countryname=="Slovenia"&year==2003&party==97521
		replace party_perc4=(4.4*(date("31122003", "DMY")-date ("31122002", "DMY")))/(64.4*365)*lrmum3 if ///
	countryname=="Slovenia"&year==2003&party==97951
	
					replace number_parties=4 if countryname=="Slovenia"& year==2003

	
	*2004 change on 20/04 without elections and on 03/12 following elections
	*first the old coalition
		replace party_perc=(37.8*(date("20042004", "DMY")-date ("31122003", "DMY")))/(64.4*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==2004&party[_n-1]==97421
		replace party_perc2=(12.2*(date("20042004", "DMY")-date ("31122003", "DMY")))/(64.4*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==2004&party[_n-1]==97321&party==97321
		replace party_perc3=(10*(date("20042004", "DMY")-date ("31122003", "DMY")))/(64.4*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==2004&party[_n-1]==97521
		replace party_perc4=(4.4*(date("20042004", "DMY")-date ("31122003", "DMY")))/(64.4*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==2004&party[_n-1]==97951
	
	**second coalition lds zlsd and desus
		replace party_perc5=(37.8*(date("03122004", "DMY")-date ("20042004", "DMY")))/(54.4*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==2004&party[_n-1]==97421
		replace party_perc6=(12.2*(date("03122004", "DMY")-date ("20042004", "DMY")))/(54.4*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==2004&party[_n-1]==97321&party==97321
		replace party_perc7=(4.4*(date("03122004", "DMY")-date ("20042004", "DMY")))/(54.4*366)*lrmum3[_n-1] if ///
	countryname=="Slovenia"&year==2004&party[_n-1]==97951
	
	*third coalition sds nsi sls desus
		replace party_perc8=(32.2*(date("31122004", "DMY")-date ("03122004", "DMY")))/(54.4*366)*lrmum3 if ///
	countryname=="Slovenia"&year==2004&party==97330
		replace party_perc9=(10*(date("31122004", "DMY")-date ("03122004", "DMY")))/(54.4*366)*lrmum3 if ///
	countryname=="Slovenia"&year==2004&party==97522
		replace party_perc10=(7.8*(date("31122004", "DMY")-date ("03122004", "DMY")))/(54.4*366)*lrmum3 if ///
	countryname=="Slovenia"&year==2004&party==97521
		replace party_perc11=(4.4*(date("31122004", "DMY")-date ("03122004", "DMY")))/(54.4*366)*lrmum3 if ///
	countryname=="Slovenia"&year==2004&party==97951
	
					replace number_parties=(date("20042004", "DMY")-date ("31122003", "DMY"))/366*4+ ///
					(date("03122004", "DMY")-date ("20042004", "DMY"))/366*3+ ///
					(date("31122004", "DMY")-date ("03122004", "DMY"))/366*4 if countryname=="Slovenia"& year==2004
	
	
	*ALBANIA     all info is from Handbook of political change in eastern europe
	*first gov considered starting in 1992; in 1991 most of it is just caretaker
	*1992 change on 13/04/1992 following elections
	*first coalition just pssh
		replace party_perc=(67.7*(date("13041992", "DMY")-date ("31121991", "DMY")))/(67.7*366)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==1992&party[_n-1]==75220
	*second coalition pd pr
		replace party_perc=(65.7*(date("31121992", "DMY")-date ("13041992", "DMY")))/(66.4*366)*lrmum3 if ///
	countryname=="Albania"&year==1992&party==75624
		replace party_perc2=(.7*(date("31121992", "DMY")-date ("13041992", "DMY")))/(66.4*366)*lrmum3 if ///
	countryname=="Albania"&year==1992&party==75722
	
					replace number_parties=(date("13041992", "DMY")-date ("31121991", "DMY"))/366*1+ ///
					(date("31121992", "DMY")-date ("13041992", "DMY"))/366*2 if countryname=="Albania"& year==1992
	
	***1993, 1994, 1995 the same coalition
		replace party_perc=(65.7*(date("31121993", "DMY")-date ("31121992", "DMY")))/(66.4*365)*lrmum3 if ///
	countryname=="Albania"&year==1993&party==75624
		replace party_perc2=(.7*(date("31121993", "DMY")-date ("31121992", "DMY")))/(66.4*365)*lrmum3 if ///
	countryname=="Albania"&year==1993&party==75722
	
		replace party_perc=(65.7*(date("31121993", "DMY")-date ("31121992", "DMY")))/(66.4*365)*lrmum3 if ///
	countryname=="Albania"&year==1994&party==75624
		replace party_perc2=(.7*(date("31121993", "DMY")-date ("31121992", "DMY")))/(66.4*365)*lrmum3 if ///
	countryname=="Albania"&year==1994&party==75722
	
		replace party_perc=(65.7*(date("31121993", "DMY")-date ("31121992", "DMY")))/(66.4*365)*lrmum3 if ///
	countryname=="Albania"&year==1995&party==75624
		replace party_perc2=(.7*(date("31121993", "DMY")-date ("31121992", "DMY")))/(66.4*365)*lrmum3 if ///
	countryname=="Albania"&year==1995&party==75722
	
					replace number_parties=2 if countryname=="Albania"& year==1993
					replace number_parties=2 if countryname=="Albania"& year==1994
					replace number_parties=2 if countryname=="Albania"& year==1995

	
	***1996 
	* on july 11 a new gov following elections still pd and pr. there's a third party bsd with no seats in parl
	*old coalition first
		replace party_perc=(65.7*(date("11071996", "DMY")-date ("31121995", "DMY")))/(66.4*366)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==1996&party[_n-1]==75624&party==75624
		replace party_perc2=(.7*(date("11071996", "DMY")-date ("31121995", "DMY")))/(66.4*366)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==1996&party[_n-1]==75722
	
	***new coalition
		replace party_perc3=(87.14*(date("31121996", "DMY")-date ("11071996", "DMY")))/(89.28*366)*lrmum3 if ///
	countryname=="Albania"&year==1996&party==75624
		replace party_perc4=(2.14*(date("31121996", "DMY")-date ("11071996", "DMY")))/(89.28*366)*lrmum3 if ///
	countryname=="Albania"&year==1996&party==75722
	
					replace number_parties=2 if countryname=="Albania"& year==1996

	
	*1997 change on 11 march, with no elections a lot or parties (all) but only 5 have representation in parliament
	*pd, pssh, pr, pbdnj, pbk
	*second change following elections on 25/07/1997
	*first the old coalition
		replace party_perc=(87.14*(date("11031997", "DMY")-date ("31121996", "DMY")))/(89.28*365)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==1997&party[_n-1]==75624
		replace party_perc2=(2.14*(date("11031997", "DMY")-date ("31121996", "DMY")))/(89.28*365)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==1997&party[_n-1]==75722
	
	*second coalition bw 11/03/1997 and 25/07/1997
		replace party_perc3=(87.14*(date("25071997", "DMY")-date ("11031997", "DMY")))/(100*365)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==1997&party[_n-1]==75624
		replace party_perc4=(7.14*(date("25071997", "DMY")-date ("11031997", "DMY")))/(100*365)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==1997&party[_n-1]==75220	
		replace party_perc5=(2.14*(date("25071997", "DMY")-date ("11031997", "DMY")))/(100*365)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==1997&party[_n-1]==75722
		replace party_perc6=(2.14*(date("25071997", "DMY")-date ("11031997", "DMY")))/(100*365)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==1997&party[_n-1]==75951
		replace party_perc7=(1.43*(date("25071997", "DMY")-date ("11031997", "DMY")))/(100*365)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==1997&party[_n-1]==75721
	
	**third coalition on 25/07/1997 pssh, psd, pad pa pbdnj
		replace party_perc8=(66.88*(date("31121997", "DMY")-date ("25071997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1997&party==75220
		replace party_perc9=(5.96*(date("31121997", "DMY")-date ("25071997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1997&party==75320
		replace party_perc10=(1.33*(date("31121997", "DMY")-date ("25071997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1997&party==75421
		replace party_perc11=(.66*(date("31121997", "DMY")-date ("25071997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1997&party==75810
		replace party_perc12=(2.65*(date("31121997", "DMY")-date ("25071997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1997&party==75951 
	
					replace number_parties=(date("11031997", "DMY")-date ("31121996", "DMY"))/365*2+ ///
					(date("25071997", "DMY")-date ("11031997", "DMY"))/365*5+ ///
					(date("31121997", "DMY")-date ("25071997", "DMY"))/365*5 if countryname=="Albania"& year==1997
	
	*1998 a lot of changes based on the dataset, hosever same coalition throughout the yyear
		replace party_perc=(66.88*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1998&party==75220
		replace party_perc2=(5.96*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1998&party==75320
		replace party_perc3=(1.33*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1998&party==75421
		replace party_perc4=(.66*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1998&party==75810
		replace party_perc5=(2.65*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1998&party==75951 
	
	*1999-2000 same coalition
		replace party_perc=(66.88*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1999&party==75220
		replace party_perc2=(5.96*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1999&party==75320
		replace party_perc3=(1.33*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1999&party==75421
		replace party_perc4=(.66*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1999&party==75810
		replace party_perc5=(2.65*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==1999&party==75951 
	
		replace party_perc=(66.88*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==2000&party==75220
		replace party_perc2=(5.96*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==2000&party==75320
		replace party_perc3=(1.33*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==2000&party==75421
		replace party_perc4=(.66*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==2000&party==75810
		replace party_perc5=(2.65*(date("31121998", "DMY")-date ("31121997", "DMY")))/(77.48*365)*lrmum3 if ///
	countryname=="Albania"&year==2000&party==75951 

					replace number_parties=5 if countryname=="Albania"& year==1998
					replace number_parties=5 if countryname=="Albania"& year==1999
					replace number_parties=5 if countryname=="Albania"& year==2000

	
	
	
	*2001 change on sept 6 following elections
	*first the old coalition
		replace party_perc=(66.88*(date("06092001", "DMY")-date ("31122000", "DMY")))/(77.48*365)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==2001&party[_n-1]==75220
		replace party_perc2=(5.96*(date("06092001", "DMY")-date ("31122000", "DMY")))/(77.48*365)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==2001&party[_n-1]==75320
		replace party_perc3=(1.33*(date("06092001", "DMY")-date ("31122000", "DMY")))/(77.48*365)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==2001&party[_n-1]==75421
		replace party_perc4=(.66*(date("06092001", "DMY")-date ("31122000", "DMY")))/(77.48*365)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==2001&party[_n-1]==75810
		replace party_perc5=(2.65*(date("06092001", "DMY")-date ("31122000", "DMY")))/(77.48*365)*lrmum3[_n-1] if ///
	countryname=="Albania"&year==2001&party[_n-1]==75951 
	
	*second coalition includes pssh psd pd psv91(no seats)
		replace party_perc6=(52.14*(date("31122001", "DMY")-date ("06092001", "DMY")))/(77.85*365)*lrmum3 if ///
	countryname=="Albania"&year==2001&party==75220
		replace party_perc7=(2.86*(date("31122001", "DMY")-date ("06092001", "DMY")))/(77.85*365)*lrmum3 if ///
	countryname=="Albania"&year==2001&party==75320
		replace party_perc8=(22.85*(date("31122001", "DMY")-date ("06092001", "DMY")))/(77.85*365)*lrmum3 if ///
	countryname=="Albania"&year==2001&party==75421
			
			
					replace number_parties=(date("06092001", "DMY")-date ("31122000", "DMY"))/365*5+ ///
					(date("31122001", "DMY")-date ("06092001", "DMY"))/365*3 if countryname=="Albania"& year==2001
			
	*2002 two changes in gov on 22/02 and on 29/07. no elections
	*first old coalition
		replace party_perc=(52.14*(date("22022002", "DMY")-date ("31122001", "DMY")))/(77.85*365)*lrmum3 if ///
	countryname=="Albania"&year==2002&party==75220
		replace party_perc2=(2.86*(date("22022002", "DMY")-date ("31122001", "DMY")))/(77.85*365)*lrmum3 if ///
	countryname=="Albania"&year==2002&party==75320
		replace party_perc3=(22.85*(date("22022002", "DMY")-date ("31122001", "DMY")))/(77.85*365)*lrmum3 if ///
	countryname=="Albania"&year==2002&party==75421
	
	*second coalition pssh psd pa pbdnj
		replace party_perc4=(52.14*(date("29072002", "DMY")-date ("22022002", "DMY")))/(59.28*365)*lrmum3 if ///
	countryname=="Albania"&year==2002&party==75220
		replace party_perc5=(2.86*(date("29072002", "DMY")-date ("22022002", "DMY")))/(59.28*365)*lrmum3 if ///
	countryname=="Albania"&year==2002&party==75320
		replace party_perc6=(2.14*(date("29072002", "DMY")-date ("22022002", "DMY")))/(59.28*365)*lrmum3 if ///
	countryname=="Albania"&year==2002&party==75810
		replace party_perc7=(2.14*(date("29072002", "DMY")-date ("22022002", "DMY")))/(59.28*365)*lrmum3 if ///
	countryname=="Albania"&year==2002&party==75951
	
	*third coalition pssh pa pbdnj
		replace party_perc8=(52.14*(date("31122002", "DMY")-date ("29072002", "DMY")))/(56.42*365)*lrmum3 if ///
	countryname=="Albania"&year==2002&party==75220
		replace party_perc9=(2.14*(date("31122002", "DMY")-date ("29072002", "DMY")))/(56.42*365)*lrmum3 if ///
	countryname=="Albania"&year==2002&party==75810
		replace party_perc10=(2.14*(date("31122002", "DMY")-date ("29072002", "DMY")))/(56.42*365)*lrmum3 if ///
	countryname=="Albania"&year==2002&party==75951
	
					replace number_parties=(date("22022002", "DMY")-date ("31122001", "DMY"))/365*3+ ///
					(date("29072002", "DMY")-date ("22022002", "DMY"))/365*4+ ///
					(date("31122002", "DMY")-date ("29072002", "DMY"))/365*3 if countryname=="Albania"& year==2002
	
	
	*2003 and 2004 same coalition no change
		replace party_perc=(52.14*(date("31122003", "DMY")-date ("31122002", "DMY")))/(56.42*365)*lrmum3 if ///
	countryname=="Albania"&year==2003&party==75220
		replace party_perc2=(2.14*(date("31122003", "DMY")-date ("31122002", "DMY")))/(56.42*365)*lrmum3 if ///
	countryname=="Albania"&year==2003&party==75810
		replace party_perc3=(2.14*(date("31122003", "DMY")-date ("31122002", "DMY")))/(56.42*365)*lrmum3 if ///
	countryname=="Albania"&year==2003&party==75951
	
		replace party_perc=(52.14*(date("31122003", "DMY")-date ("31122002", "DMY")))/(56.42*365)*lrmum3 if ///
	countryname=="Albania"&year==2004&party==75220
		replace party_perc2=(2.14*(date("31122003", "DMY")-date ("31122002", "DMY")))/(56.42*365)*lrmum3 if ///
	countryname=="Albania"&year==2004&party==75810
		replace party_perc3=(2.14*(date("31122003", "DMY")-date ("31122002", "DMY")))/(56.42*365)*lrmum3 if ///
	countryname=="Albania"&year==2004&party==75951
	
					replace number_parties=3 if countryname=="Albania"& year==2003
					replace number_parties=3 if countryname=="Albania"& year==2004

	
	
	****CROATIA
	*first elections in 1992, so first gov in 1993, entirely made of hdz
		replace party_perc=lrmum3 if countryname=="Croatia"&year==1993&party==81711
		
					replace number_parties=1 if countryname=="Croatia"& year==1993

	
	*1994 and 1995 still just hdz; but 1995 after elections; change in gov is nov 7 1995
	replace party_perc=lrmum3 if countryname=="Croatia"&year==1994&party==81711
	*1995 first the old party
		replace party_perc=(61.6*(date("07111995", "DMY")-date ("31121994", "DMY")))/(61.6*365)*lrmum3[_n-1] if ///
	countryname=="Croatia"&year==1995&party[_n-1]==81711
	*second party
		replace party_perc2=(59.1*(date("31121995", "DMY")-date ("07111995", "DMY")))/(59.1*365)*lrmum3 if ///
	countryname=="Croatia"&year==1995&party==81711	
	
						replace number_parties=1 if countryname=="Croatia"& year==1994
					replace number_parties=1 if countryname=="Croatia"& year==1995

	
	*1996-1999 just hdz
			replace party_perc=lrmum3 if countryname=="Croatia"&year==1996&party==81711

			replace party_perc=lrmum3 if countryname=="Croatia"&year==1997&party==81711

			replace party_perc=lrmum3 if countryname=="Croatia"&year==1998&party==81711

			replace party_perc=lrmum3 if countryname=="Croatia"&year==1999&party==81711

					replace number_parties=1 if countryname=="Croatia"& year==1996
					replace number_parties=1 if countryname=="Croatia"& year==1997
					replace number_parties=1 if countryname=="Croatia"& year==1998
					replace number_parties=1 if countryname=="Croatia"& year==1999

			
			
	*2000 change on jan 27 following elections
	*first the old coalition
		replace party_perc=(59.1*(date("27012000", "DMY")-date ("31121999", "DMY")))/(59.1*366)*lrmum3[_n-1] if ///
	countryname=="Croatia"&year==2000&party[_n-1]==81711
	*second coalition spd hsls hss ids hns ls : spd-hsls ran as one coalition
		replace party_perc2=(28.5*(date("31122000", "DMY")-date ("27012000", "DMY")))/(61.6*366)*lrmum3 if ///
	countryname=="Croatia"&year==2000&party==81021
		replace party_perc3=(16.6*(date("31122000", "DMY")-date ("27012000", "DMY")))/(61.6*366)*lrmum3 if ///
	countryname=="Croatia"&year==2000&party==81021
		replace party_perc4=(11.3*(date("31122000", "DMY")-date ("27012000", "DMY")))/(61.6*366)*lrmum3 if ///
	countryname=="Croatia"&year==2000&party==81810
		replace party_perc5=(2.6*(date("31122000", "DMY")-date ("27012000", "DMY")))/(61.6*366)*lrmum3 if ///
	countryname=="Croatia"&year==2000&party==81953
		replace party_perc6=(1.3*(date("31122000", "DMY")-date ("27012000", "DMY")))/(61.6*366)*lrmum3 if ///
	countryname=="Croatia"&year==2000&party==81712
		replace party_perc7=(1.3*(date("31122000", "DMY")-date ("27012000", "DMY")))/(61.6*366)*lrmum3 if ///
	countryname=="Croatia"&year==2000&party==81411
	
					replace number_parties=(date("27012000", "DMY")-date ("31121999", "DMY"))/366*1+ ///
					(date("31122000", "DMY")-date ("27012000", "DMY"))/366*6 if countryname=="Croatia"& year==2000
									
	
	*2001 same coalitioin
		replace party_perc=(28.5*(date("31122001", "DMY")-date ("31122000", "DMY")))/(61.6*365)*lrmum3 if ///
	countryname=="Croatia"&year==2001&party==81021
		replace party_perc2=(16.6*(date("31122001", "DMY")-date ("31122000", "DMY")))/(61.6*365)*lrmum3 if ///
	countryname=="Croatia"&year==2001&party==81021
		replace party_perc3=(11.3*(date("31122001", "DMY")-date ("31122000", "DMY")))/(61.6*365)*lrmum3 if ///
	countryname=="Croatia"&year==2001&party==81810
		replace party_perc4=(2.6*(date("31122001", "DMY")-date ("31122000", "DMY")))/(61.6*365)*lrmum3 if ///
	countryname=="Croatia"&year==2001&party==81953
		replace party_perc5=(1.3*(date("31122001", "DMY")-date ("31122000", "DMY")))/(61.6*365)*lrmum3 if ///
	countryname=="Croatia"&year==2001&party==81712
		replace party_perc6=(1.3*(date("31122001", "DMY")-date ("31122000", "DMY")))/(61.6*365)*lrmum3 if ///
	countryname=="Croatia"&year==2001&party==81411

					replace number_parties=6 if countryname=="Croatia"& year==2001

	
	*2002 change on 30/07/2002 without elections
	*first the old coalition 
		replace party_perc=(28.5*(date("30072002", "DMY")-date ("31122001", "DMY")))/(61.6*365)*lrmum3 if ///
	countryname=="Croatia"&year==2002&party==81021
		replace party_perc2=(16.6*(date("30072002", "DMY")-date ("31122001", "DMY")))/(61.6*365)*lrmum3 if ///
	countryname=="Croatia"&year==2002&party==81021
		replace party_perc3=(11.3*(date("30072002", "DMY")-date ("31122001", "DMY")))/(61.6*365)*lrmum3 if ///
	countryname=="Croatia"&year==2002&party==81810
		replace party_perc4=(2.6*(date("30072002", "DMY")-date ("31122001", "DMY")))/(61.6*365)*lrmum3 if ///
	countryname=="Croatia"&year==2002&party==81953
		replace party_perc5=(1.3*(date("30072002", "DMY")-date ("31122001", "DMY")))/(61.6*365)*lrmum3 if ///
	countryname=="Croatia"&year==2002&party==81712
		replace party_perc6=(1.3*(date("30072002", "DMY")-date ("31122001", "DMY")))/(61.6*365)*lrmum3 if ///
	countryname=="Croatia"&year==2002&party==81411
	
	*second coalition spd hss hns ls libra/hsls
		replace party_perc7=(28.5*(date("31122002", "DMY")-date ("30072002", "DMY")))/(49*365)*lrmum3 if ///
	countryname=="Croatia"&year==2002&party==81021
		replace party_perc8=(11.3*(date("31122002", "DMY")-date ("30072002", "DMY")))/(49*365)*lrmum3 if ///
	countryname=="Croatia"&year==2002&party==81810
		replace party_perc9=(1.3*(date("31122002", "DMY")-date ("30072002", "DMY")))/(49*365)*lrmum3 if ///
	countryname=="Croatia"&year==2002&party==81712
		replace party_perc10=(1.3*(date("31122002", "DMY")-date ("30072002", "DMY")))/(49*365)*lrmum3 if ///
	countryname=="Croatia"&year==2002&party==81411
		replace party_perc11=(6.6*(date("31122002", "DMY")-date ("30072002", "DMY")))/(49*365)*lrmum3 if ///
	countryname=="Croatia"&year==2002&party==81021
	
					replace number_parties=(date("30072002", "DMY")-date ("31122001", "DMY"))/365*6+ ///
					(date("31122002", "DMY")-date ("30072002", "DMY"))/365*5 if countryname=="Croatia"& year==2002
	
	*2003 change on 23/12 following elections
	*first coalition
		replace party_perc=(28.5*(date("23122003", "DMY")-date ("31122002", "DMY")))/(49*365)*lrmum3[_n-1] if ///
	countryname=="Croatia"&year==2003&party[_n-1]==81021&party==81021
								*CHANGED TO ADD PARTY TOO**
		replace party_perc2=(11.3*(date("23122003", "DMY")-date ("31122002", "DMY")))/(49*365)*lrmum3[_n-1] if ///
	countryname=="Croatia"&year==2003&party[_n-1]==81810
		replace party_perc3=(1.3*(date("23122003", "DMY")-date ("31122002", "DMY")))/(49*365)*lrmum3[_n-1] if ///
	countryname=="Croatia"&year==2003&party[_n-1]==81712
		replace party_perc4=(1.3*(date("23122003", "DMY")-date ("31122002", "DMY")))/(49*365)*lrmum3[_n-1] if ///
	countryname=="Croatia"&year==2003&party[_n-1]==81411
		replace party_perc5=(6.6*(date("23122003", "DMY")-date ("31122002", "DMY")))/(49*365)*lrmum3[_n-1] if ///
	countryname=="Croatia"&year==2003&party[_n-1]==81021&party==81021
	
	**second coalition three parties, but only two have seats in the parliametn hdz and dc
		replace party_perc6=(43.4*(date("31122003", "DMY")-date ("23122003", "DMY")))/(44*365)*lrmum3 if ///
	countryname=="Croatia"&year==2003&party==81711
		replace party_perc7=(.6*(date("31122003", "DMY")-date ("23122003", "DMY")))/(44*365)*lrmum3 if ///
	countryname=="Croatia"&year==2003&party==81042
	
					replace number_parties=(date("23122003", "DMY")-date ("31122002", "DMY"))/365*5+ ///
					(date("31122003", "DMY")-date ("23122003", "DMY"))/365*2 if countryname=="Croatia"& year==2003
	
	*2004 same coalition
		replace party_perc=(43.4*(date("31122004", "DMY")-date ("31122003", "DMY")))/(44*366)*lrmum3 if ///
	countryname=="Croatia"&year==2004&party==81711
		replace party_perc=(.6*(date("31122004", "DMY")-date ("31122003", "DMY")))/(44*366)*lrmum3 if ///
	countryname=="Croatia"&year==2004&party==81042
	
					replace number_parties=2 if countryname=="Croatia"& year==2004

	
	****MACEDONIA  
	*first gov in september 1992, but cannot compute measure for 1992; 
	
	*1993 four parties sdsm(skm-pdp in 1990 elections) ppd/pdp srsm-lp spm
		replace party_perc=(25.8*(date("31121993", "DMY")-date ("31121992", "DMY")))/(59.1*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1993&party==89221
		replace party_perc2=(15*(date("31121993", "DMY")-date ("31121992", "DMY")))/(59.1*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1993&party==89959
		replace party_perc3=(15*(date("31121993", "DMY")-date ("31121992", "DMY")))/(59.1*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1993&party==89222
		replace party_perc4=(3.3*(date("31121993", "DMY")-date ("31121992", "DMY")))/(59.1*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1993&party==89320	
	
	**the handbook is the same
	
					replace number_parties=4 if countryname=="Macedonia"& year==1993
					*pdp-ndp are two parties
	
	
	*1994 change in gov on 20/12/1994 following elections
	*first the old coalition
		replace party_perc=(25.8*(date("20121994", "DMY")-date ("31121993", "DMY")))/(59.1*365)*lrmum3[_n-1] if ///
	countryname=="Macedonia"&year==1994&party[_n-1]==89221
		replace party_perc2=(15*(date("20121994", "DMY")-date ("31121993", "DMY")))/(59.1*365)*lrmum3[_n-1] if ///
	countryname=="Macedonia"&year==1994&party[_n-1]==89959
		replace party_perc3=(15*(date("20121994", "DMY")-date ("31121993", "DMY")))/(59.1*365)*lrmum3[_n-1] if ///
	countryname=="Macedonia"&year==1994&party[_n-1]==89222
		replace party_perc4=(3.3*(date("20121994", "DMY")-date ("31121993", "DMY")))/(59.1*365)*lrmum3[_n-1] if ///
	countryname=="Macedonia"&year==1994&party[_n-1]==89320	
	
	*second coalition sdsm lp pdpm  spm (from macedonia protec_tcm)
	*https://fsw.vu.nl/en/departments/political-science-and-public-administration/staff/woldendorp/party-government-data-set/index.aspx
	replace party_perc5=(51.6*(date("31121994", "DMY")-date ("20121994", "DMY")))/(92.5*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1994&party==89221
	replace party_perc6=(22.5*(date("31121994", "DMY")-date ("20121994", "DMY")))/(92.5*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1994&party==89222
	replace party_perc7=(11.6*(date("31121994", "DMY")-date ("20121994", "DMY")))/(92.5*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1994&party==89951
	replace party_perc8=(6.6*(date("31121994", "DMY")-date ("20121994", "DMY")))/(92.5*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1994&party==89320
	
					replace number_parties=4 if countryname=="Macedonia"& year==1994
					*pdp-ndp are two parties
	
	*1995 the same coalition the entire year
	replace party_perc=(51.6*(date("31121995", "DMY")-date ("31121994", "DMY")))/(92.5*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1995&party==89221
	replace party_perc2=(22.5*(date("31121995", "DMY")-date ("31121994", "DMY")))/(92.5*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1995&party==89222
	replace party_perc3=(11.6*(date("31121995", "DMY")-date ("31121994", "DMY")))/(92.5*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1995&party==89951
	replace party_perc4=(6.6*(date("31121995", "DMY")-date ("31121994", "DMY")))/(92.5*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1995&party==89320
	
	
					replace number_parties=4 if countryname=="Macedonia"& year==1995
					*pdp-ndp are two parties
	
	*1996 change in gov on 26 feb without elections
	*old coalition first
	replace party_perc=(51.6*(date("26021996", "DMY")-date ("31121995", "DMY")))/(92.5*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1996&party==89221
	replace party_perc2=(22.5*(date("26021996", "DMY")-date ("31121995", "DMY")))/(92.5*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1996&party==89222
	replace party_perc3=(11.6*(date("26021996", "DMY")-date ("31121995", "DMY")))/(92.5*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1996&party==89951
	replace party_perc4=(6.6*(date("26021996", "DMY")-date ("31121995", "DMY")))/(92.5*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1996&party==89320

	
	*new coalition sdsm pdpm (prosperity) spm based on protec_tm
		replace party_perc6=(51.6*(date("31121996", "DMY")-date ("26021996", "DMY")))/(70*366)*lrmum3 if ///
	countryname=="Macedonia"&year==1996&party==89221
		replace party_perc7=(11.6*(date("31121996", "DMY")-date ("26021996", "DMY")))/(70*366)*lrmum3 if ///
	countryname=="Macedonia"&year==1996&party==89951
		replace party_perc8=(6.6*(date("31121996", "DMY")-date ("26021996", "DMY")))/(70*366)*lrmum3 if ///
	countryname=="Macedonia"&year==1996&party==89320
	
	
					replace number_parties=(date("26021996", "DMY")-date ("31121995", "DMY"))/366*4+ ///
					(date("31121996", "DMY")-date ("26021996", "DMY"))/366*3 if countryname=="Macedonia"& year==1996
	
	*1997 nothing changes the same coalition protec_tm
		replace party_perc=(51.6*(date("31121997", "DMY")-date ("31121996", "DMY")))/(70*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1997&party==89221
		replace party_perc2=(11.6*(date("31121997", "DMY")-date ("31121996", "DMY")))/(70*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1997&party==89951
		replace party_perc3=(6.6*(date("31121997", "DMY")-date ("31121996", "DMY")))/(70*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1997&party==89320
	
					replace number_parties=3 if countryname=="Macedonia"& year==1997

	
	* 1998 change on 30/11/1998 following elections
	*first the old coalition protec_tm
		replace party_perc=(51.6*(date("30111998", "DMY")-date ("31121997", "DMY")))/(70*365)*lrmum3[_n-1] if ///
	countryname=="Macedonia"&year==1998&party==89221
		replace party_perc2=(11.6*(date("30111998", "DMY")-date ("31121997", "DMY")))/(70*365)*lrmum3[_n-1] if ///
	countryname=="Macedonia"&year==1998&party==89951
		replace party_perc3=(6.6*(date("30111998", "DMY")-date ("31121997", "DMY")))/(70*365)*lrmum3[_n-1] if ///
	countryname=="Macedonia"&year==1998&party==89320
	
	*second coalition vmro-dpm, da, dpa (albanian party), which ran in alliance with pdp for which we have data
	*we don't have manifesto data for dpa, but in elections they are in alliance with pdp (89951)
		replace party_perc4=(40.8*(date("31121998", "DMY")-date ("30111998", "DMY")))/(60.8*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1998&party==89710
		replace party_perc5=(10.8*(date("31121998", "DMY")-date ("30111998", "DMY")))/(60.8*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1998&party==89321
		replace party_perc6=(9.2*(date("31121998", "DMY")-date ("30111998", "DMY")))/(60.8*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1998&party==89951

	
					replace number_parties=3 if countryname=="Macedonia"& year==1998
					*vmro-dpm is one party
	
	*1999 same coalition all year
		replace party_perc=(40.8*(date("31121999", "DMY")-date ("31121998", "DMY")))/(60.8*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1999&party==89710
		replace party_perc2=(10.8*(date("31121999", "DMY")-date ("31121998", "DMY")))/(60.8*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1999&party==89321
		replace party_perc3=(9.2*(date("31121999", "DMY")-date ("31121998", "DMY")))/(60.8*365)*lrmum3 if ///
	countryname=="Macedonia"&year==1999&party==89951
	
					replace number_parties=3 if countryname=="Macedonia"& year==1999

	
	*2000 change on 30/11/2000 without elections
	*old coalition first
		replace party_perc=(40.8*(date("30112000", "DMY")-date ("31121999", "DMY")))/(60.8*366)*lrmum3 if ///
	countryname=="Macedonia"&year==2000&party==89710
		replace party_perc2=(10.8*(date("30112000", "DMY")-date ("31121999", "DMY")))/(60.8*366)*lrmum3 if ///
	countryname=="Macedonia"&year==2000&party==89321
		replace party_perc3=(9.2*(date("30112000", "DMY")-date ("31121999", "DMY")))/(60.8*366)*lrmum3 if ///
	countryname=="Macedonia"&year==2000&party==89951
	
	*second coalition 
	* in the other document is just vmro and dpa; will use this one from document: Macedonia protec_tcm
		replace party_perc4=(40.8*(date("31122000", "DMY")-date ("30112000", "DMY")))/(50.1*366)*lrmum3 if ///
	countryname=="Macedonia"&year==2000&party==89710
		replace party_perc5=(9.2*(date("31122000", "DMY")-date ("30112000", "DMY")))/(50.1*366)*lrmum3 if ///
	countryname=="Macedonia"&year==2000&party==89951

	
					replace number_parties=(date("30112000", "DMY")-date ("31121999", "DMY"))/366*3+ ///
					(date("31122000", "DMY")-date ("30112000", "DMY"))/366*2 if countryname=="Macedonia"& year==2000
					*replace number_parties=3 if countryname=="Macedonia"&year==2000

	***2001 two changes without elections: from document: Macedonia protec_tcm
	*first old coalition which ends on 13/05/2001
		replace party_perc=(40.8*(date("13052001", "DMY")-date ("31122000", "DMY")))/(50.1*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2001&party==89710
		replace party_perc2=(9.2*(date("13052001", "DMY")-date ("31122000", "DMY")))/(50.1*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2001&party==89951
	
	*second coalition ends in 21/11/2001 vmro, sdsm, ldp(4), dpa(11) (together they have 15 seats)
		replace party_perc3=(49*(date("21112001", "DMY")-date ("13052001", "DMY")))/(91*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2001&party==89710
		replace party_perc4=(27*(date("21112001", "DMY")-date ("13052001", "DMY")))/(91*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2001&party==89221
		replace party_perc5=(4*(date("21112001", "DMY")-date ("13052001", "DMY")))/(91*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2001&party==89224
		replace party_perc5=(11*(date("21112001", "DMY")-date ("13052001", "DMY")))/(91*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2001&party==89951
	
	*third coalition begins in 21/11/2001 vmro, dpa, pdpm (these last two are the same coalition so i'll just use pdpm)
		replace party_perc6=(49*(date("31122001", "DMY")-date ("21112001", "DMY")))/(74*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2001&party==89710
		replace party_perc7=(11*(date("31122001", "DMY")-date ("21112001", "DMY")))/(74*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2001&party==89951
		replace party_perc8=(14*(date("31122001", "DMY")-date ("21112001", "DMY")))/(74*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2001&party==89951

	
					replace number_parties=(date("13052001", "DMY")-date ("31122000", "DMY"))/365*2+ ///
					(date("21112001", "DMY")-date ("13052001", "DMY"))/365*4+ ///
					(date("31122001", "DMY")-date ("21112001", "DMY"))/365*3 if countryname=="Macedonia"& year==2001

	
	*2002 change on 01/11/2002 following elections
	*first the old coalition
		replace party_perc=(49*(date("01112002", "DMY")-date ("31122001", "DMY")))/(74*365)*lrmum3[_n-1] if ///
	countryname=="Macedonia"&year==2002&party[_n-1]==89710&party==89710
		replace party_perc2=(11*(date("01112002", "DMY")-date ("31122001", "DMY")))/(74*365)*lrmum3[_n-1] if ///
	countryname=="Macedonia"&year==2002&party[_n-1]==89224
		replace party_perc3=(14*(date("01112002", "DMY")-date ("31122001", "DMY")))/(74*365)*lrmum3[_n-1] if ///
	countryname=="Macedonia"&year==2002&party[_n-1]==89951

	
	*second coalition sdsm dui ldp
	
		replace party_perc4=(43*(date("31122002", "DMY")-date ("01112002", "DMY")))/(71*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2002&party==89221
		replace party_perc5=(16*(date("31122002", "DMY")-date ("01112002", "DMY")))/(71*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2002&party==89940
		replace party_perc6=(12*(date("31122002", "DMY")-date ("01112002", "DMY")))/(71*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2002&party==89224
	
					replace number_parties=3 if countryname=="Macedonia"& year==2002
	
	*2003 same coalition
		replace party_perc=(43*(date("31122003", "DMY")-date ("31122002", "DMY")))/(71*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2003&party==89221
		replace party_perc2=(16*(date("31122003", "DMY")-date ("31122002", "DMY")))/(71*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2003&party==89940
		replace party_perc3=(12*(date("31122003", "DMY")-date ("31122002", "DMY")))/(71*365)*lrmum3 if ///
	countryname=="Macedonia"&year==2003&party==89224

	
	*2004 same coalition
		replace party_perc4=(43*(date("31122004", "DMY")-date ("31122003", "DMY")))/(71*366)*lrmum3 if ///
	countryname=="Macedonia"&year==2004&party==89221
		replace party_perc5=(16*(date("31122004", "DMY")-date ("31122003", "DMY")))/(71*366)*lrmum3 if ///
	countryname=="Macedonia"&year==2004&party==89940
		replace party_perc6=(12*(date("31122004", "DMY")-date ("31122003", "DMY")))/(71*366)*lrmum3 if ///
	countryname=="Macedonia"&year==2004&party==89224

	
					replace number_parties=3 if countryname=="Macedonia"& year==2003
					replace number_parties=3 if countryname=="Macedonia"& year==2004
	
	***compute final values
	gen party_perc_final=party_perc+party_perc2+party_perc3+party_perc4+party_perc5+party_perc6+party_perc7+party_perc8+ ///
	party_perc9+party_perc10+party_perc11+party_perc12+party_perc13
	
	by countryname year, sort: egen lr4=total(party_perc_final)
	drop if countryname==countryname[_n-1]&year==year[_n-1]
	
			recode lr4*(0=.)
		recode lr4*(.=0) if countryname=="Croatia"&year<2000&year>1994
	
	***gen standardized variables bw 0 and 1
	*but first get rid of the early years where there are no full govs
	drop if countryname=="Albania"&year==1991
	drop if countryname=="Bulgaria"&year==1990
		drop if countryname=="Bulgaria"&year==1993
			drop if countryname=="Bulgaria"&year==1994


	by countryname, sort: egen max_lr=max(lr4)
	by countryname, sort: egen min_lr=min(lr4)
	gen stand_lr4=(lr4-min_lr)/(max_lr-min_lr)

	
	keep countryname year lr4 stand number_parties
	rename lr4 lr_`i'

	sort countryname year
	
	save "datasets/adjusted_mcss`i'.dta", replace
	
		****create average government values per year
	
	by year, sort: egen avg_adj_lr`i'=mean(lr_`i')
	
	drop if year==year[_n-1]

	*but first get rid of the early years where there are no full govs
drop if year<1992
			
	save "datasets/average_adj_mcss`i'.dta", replace
}
